2016-09-26 51 views
0

link開始,我需要創建一個XSLT,其中輸入和輸出XML應該與下面相同。請建議如何爲以下輸入XML創建XSLT以實現與輸出相同的效果。XSLT當需要的輸入和輸出xslt相同時

<abc:Envelope xmlns:NS1="http://schemas.xmlsoap.org/soap/envelope/"> 
    <abc:Body> 
     <def:CheckOutput xmlns:def="http://www.test.com/service"> 
     <def:Error> 
      <def:Code>0</def:Code> 
     </def:Error> 
     </def:CheckOutput> 
    </abc:Body> 
</abc:Envelope> 
+0

有一個讀了關於XSLT恆等變換(https://en.wikipedia.org/wiki/Identity_transform)。 –

+0

如果沒有任何變化,轉化的目的是什麼? –

回答

0

你的XML是無效,導致命名空間前綴沒有定義abc。名稱空間前綴NS1已定義,但從未使用過。也許你的input-xml混淆了。

隨着有效輸入,您的XSLT會是這樣:

<xsl:stylesheet version="1.0" 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
    xmlns:abc="http://schemas.xmlsoap.org/soap/envelope/" 
    xmlns:def="http://www.test.com/service"> 

    <xsl:template match="@* | node()"> 
     <xsl:copy> 
      <xsl:apply-templates select="@* | node()" /> 
     </xsl:copy> 
    </xsl:template> 
</xsl:stylesheet>