我有一個xsl,它複製一個xml文件並重命名根標記。xsl:轉換名稱空間標記
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version = '1.0'
xmlns:xsl='http://www.w3.org/1999/XSL/Transform' xmlns:abc="http://example.com">
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="root">
<test>
<xsl:apply-templates select="node()|@*"/>
</test>
</xsl:template>
<!--xsl:template match="abc:set">
-<xsl:apply-templates select="node()|@*"/>-
</xsl:template-->
</xsl:stylesheet>
這工作正常,但是當我去掉最後一個塊來處理一些命名空間的標籤我得到的是說,什麼是錯與複製聲明的錯誤。我如何匹配和轉換名稱空間標籤?
如果您發佈示例XML和/或確切的錯誤消息,這將會很有幫助。 –
不要向我們顯示有效的代碼,向我們展示不起作用的代碼,並告訴我們它是如何失敗的。我相信這個信息比「副本聲明有問題」更具體。 –
錯誤消息是:XSLTProcessor :: transformToXml():運行時錯誤:xxx.xsl行zz元素副本。沒有工作的代碼只是上面沒有註釋字符'!'和' - '的代碼。但現在問題解決了,謝謝。 – stofl