0
我必須刪除xsi:schemaLocation,但我沒有得到它的工作, 我想我在wt:Envelope/wt:Body/wt中做了一些錯誤:MessageParts/* [not(名稱()= 'XSI:的schemaLocation')的定義,但不知道如何解決這個刪除文檔節點上的屬性
XML數據源:
<?xml version="1.0" encoding="UTF-8"?>
<Envelope xmlns="http://schemas.microsoft.com/dynamics/2011/01/documents/Message">
<Header>
<MessageId>{AAE4C191-6D18-4823-A29D-9C6CA68113C2}</MessageId>
<Action>http://tempuri.org/VendPaymentsService/find</Action>
</Header>
<Body>
<MessageParts xmlns="http://schemas.microsoft.com/dynamics/2011/01/documents/Message">
<Document xsi:schemaLocation="urn:iso:std:iso:20022:tech:xsd:pain.001.001.03 pain.001.001.03.xsd"
xmlns="urn:iso:std:iso:20022:tech:xsd:pain.001.001.03"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<CstmrCdtTrfInitn>
....
</CstmrCdtTrfInitn>
</Document>
</MessageParts>
</Body>
</Envelope>
我的XSLT
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:wt="http://schemas.microsoft.com/dynamics/2011/01/documents/Message"
xmlns:s1="http://schemas.microsoft.com/dynamics/2008/01/documents/VendPayments"
version="1.0">
<xsl:output method="xml" encoding="iso-8859-1" />
<xsl:template match="/">
<xsl:text disable-output-escaping="yes"><?xml version="1.0" encoding="utf-8"?></xsl:text>
<xsl:copy-of select="wt:Envelope/wt:Body/wt:MessageParts/*[not(name() ='xsi:schemaLocation')]" />
</xsl:template>
</xsl:stylesheet>
結果
<?xml version="1.0" encoding="utf-8"?>
<Document
xsi:schemaLocation="urn:iso:std:iso:20022:tech:xsd:pain.001.001.03 pain.001.001.03.xsd" xmlns="urn:iso:std:iso:20022:tech:xsd:pain.001.001.03"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<CstmrCdtTrfInitn>
..
</CstmrCdtTrfInitn>
</Document>
我在誤解什麼?
你試圖得到什麼結果?你想要''元素及其沒有'xsi:schemaLocation'屬性的子元素嗎? –
2014-11-02 15:04:31