我正在尝试使用 xsl 转换来转换以下 BankPositivePay 消息。
我拥有的 XML 消息是:
<?xml version="1.0" encoding="UTF-8"?>
<Envelope xmlns="http://schemas.microsoft.com/dynamics/2011/01/documents/Message">
<Header>
<MessageId>{A604C46E-F3E3-4BCB-9F7A-E8FD8749A7FC}</MessageId>
<Action>http://tempuri.org/BankPositivePayService/find</Action>
</Header>
<Body>
<MessageParts xmlns="http://schemas.microsoft.com/dynamics/2011/01/documents/Message">
<BankPositivePay xmlns="http://schemas.microsoft.com/dynamics/2008/01/documents/BankPositivePay">
<BankAccountTable class="entity">
<AccountID>USA OPER</AccountID>
<AccountNum>34567</AccountNum>
<CurrencyCode>USD</CurrencyCode>-<LedgerDimension><MainAccount xmlns="http://schemas.microsoft.com/dynamics/2008/01/sharedtypes">110110</MainAccount></LedgerDimension>-<BankChequeTable class="entity"><AccountID>USA OPER</AccountID><AmountCur>3500.00</AmountCur><ChequeNum>1132</ChequeNum><ChequeStatus>Payment</ChequeStatus><RecipientAccountNum>1001</RecipientAccountNum><TransDate>2013-08-16</TransDate>-<VendTable class="entity"><Currency>USD</Currency>-<DefaultDimension>-<Values xmlns="http://schemas.microsoft.com/dynamics/2008/01/sharedtypes">-<Value><Name>CustomDepartment</Name><Value>060</Value></Value></Values></DefaultDimension><VendGroup>10</VendGroup></VendTable>-<CompanyInfo class="entity" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="AxdEntity_CompanyInfo_CompanyInfo"><DataArea>ceu</DataArea></CompanyInfo></BankChequeTable></BankAccountTable></BankPositivePay></MessageParts></Body></Envelope>
我正在使用的 xsl 文件是
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:Message="http://schemas.microsoft.com/dynamics/2011/01/documents/Message"
xmlns:BankPositivePay="http://schemas.microsoft.com/dynamics/2008/01/documents/BankPositivePay"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes" encoding="utf-8" omit-xml-declaration="no"/>
<xsl:template match="Message:Envelope">
<Test>
<Header>
<records>
<record>
<xsl:value-of select="Message:Body/Message:MessageParts/BankPositivePay:BankPositivePay/BankPositivePay:BankAccountTable/BankPositivePay:AccountID"/>
</record>
</records>
</Header>
</Test>
</xsl:template>
</xsl:stylesheet>
我编写的 xsl 文件只是没有生成 AccountID。
我得到的输出文件是这样的:
<?xml version="1.0" encoding="UTF-8"?>
<Envelope xmlns="http://schemas.microsoft.com/dynamics/2011/01/documents/Message">
<Header>
<MessageId>{CBC894EE-B70F-44E8-B37E-EA6B8F2BA327}</MessageId>
<Action>http://tempuri.org/BankPositivePayService/find</Action>
</Header>
<Body>
<MessageParts xmlns="http://schemas.microsoft.com/dynamics/2011/01/documents/Message">
<Test xmlns="">
<Header>
<records><record/></records>
</Header>
</Test>
</MessageParts>
</Body>
</Envelope>