我是xslt的新手。我试图将XML从一个模式转换为另一个模式。我想在转换后“摆脱”旧的命名空间。如果我需要它进行转换,我如何在转换后擦除旧的模式。本质上,我想http://positionskillmanagementservice.webservices.com
消失,完全由http://newschema
(我重新命名节点后)替换。我能够通过从Dimitre Novatchev的方法来执行大部分的我想要的东西:change the namespace of an element with xslt用xslt摆脱旧的命名空间
这是XML:
<ns:positionSkillResponse xmlns:ns="http://positionskillmanagementservice.webservices.com">
<ns:return>1</ns:return>
<ns:return>9</ns:return>
</ns:positionSkillResponse>
这是XSLT:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ns="http://positionskillmanagementservice.webservices.com"
version="1.0">
<xsl:output method="xml" />
<xsl:template match="ns:return">
<parameter>
<xsl:apply-templates select="@*|node()"/>
</parameter>
</xsl:template>
<xsl:template match="ns:position">
<parameter>
<xsl:apply-templates select="@*|node()"/>
</parameter>
</xsl:template>
<xsl:template match="ns:positionSkillResponse">
<positionSkillRequest >
<xsl:apply-templates select="@*|node()"/>
</positionSkillRequest >
</xsl:template>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
我检查工作与this tool。