XSLT标题自动生成

时间:2013-03-06 17:14:20

标签: html xml email xslt

在XML / XSLT电子邮件构建方面,我相当环保。我无法弄清楚如何正确调用“CampaignName”并将其放入标记中。

我的XML就是这样:

<KANARoot>
<EventRequest Id="" CompanyName="default" CampaignName="Statement_Notification">
<Customer  KeyField="alt_customer_id" alt_customer_id="-1" EmailAddress="customer@gmail.com" First_Name="Customer" Last_Name="Name" Address_Line1="" Address_Line2="" City="" State="" Postal_Code="">
<CustomerAttribute      Name="workOrder"/>
<CustomerAttribute      Name="soaMessageId">10</CustomerAttribute>
<CustomerAttribute      Name="accountType">R</CustomerAttribute>
<CustomerAttribute      Name="accountEsbNamespace">8448200010063009</CustomerAttribute>
<CustomerAttribute      Name="billingID">202</CustomerAttribute>
<CustomerAttribute      Name="divisionId">CAR</CustomerAttribute>
<CustomerAttribute      Name="workOrderTimestamp">2013-01-31T10:01:41.109-05:00</CustomerAttribute>
</Customer>
<Event CampaignName="Statement_Notification">
<ExternalXML>
<CustomerInfo>
<CustomerName>Customer Name</CustomerName>
<CustomerBusinessName>Customer</CustomerBusinessName>
<PaperLessFlag>Paperless</PaperLessFlag>
<CustomerEmailAddress>sandhya@gmai.com</CustomerEmailAddress>
</CustomerInfo>
<StatementInfo>
<AccountNumber>8448200000000001</AccountNumber>
<StatementCode/>
<StatementDate>01/31/2013</StatementDate>
<StatementDueDate>01/31/2013</StatementDueDate>
<StatementFromDate>01/31/2013</StatementFromDate>
<StatementToDate>01/31/2013</StatementToDate>
<AmountDue>1000.00</AmountDue>
</StatementInfo>
<DivisionInfo>
<DivisionID>CAR.202</DivisionID>
<BillingSystem>ACP</BillingSystem>
</DivisionInfo>
</ExternalXML>
</Event>
</EventRequest>

到目前为止我的XLST是:

<title><xsl:value-of select="EventRequest/Event/CampaignName" /></title>

但这不起作用。谢谢你的帮助。

1 个答案:

答案 0 :(得分:0)

CampaignName是一个属性,而不是Event的子元素,因此您需要一个XPath,例如EventRequest/Event/@CampaignName