0
我是新的XSLT,但我希望能够使用XSL与XML进行比较。 问题的节点可能会改变,所以我需要使用lacal-name()。使用本地名称比较XML的XSLT()
但我似乎无法做到这一点。 请检查以下并帮助我谢谢。
<xsl:output method="xml" indent="yes"/>
<xsl:param name="Doc1" select="Root/items/*" />
<xsl:param name="Doc2" select="Root/items/*" />
<xsl:variable name="Second" select="$Doc2/Root/items/*"/>
<xsl:template match="/">
<xsl:apply-templates select="$Doc1/*"/>
</xsl:template>
<xsl:template match="items">
<Root>
<xsl:for-each select="item">
<xsl:variable name="Names" select="$Second/local-name()"/>
<xsl:choose>
<xsl:when test="$Names!=$Names">
<xsl:value-of select="$Second/current()"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="current()"/>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</Root>
</xsl:template>
</xsl:stylesheet>
你能告诉我们源XML和你想要的输出? –