xpathに関連する問題をデバッグしようとしています。 xmlドキュメントを割り当てるXSLTで変数$ MetaDataを作成しましたが、何らかの理由でforeachループがその子を見つけられず、foreachループに入ることができませんでした。XSLT for-eachのXPATHが見つかりません
XSLT:
<!-- language: lang-xslt -->
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet
version="1.0"
xmlns="http://www.w3.org/TR/xhtml1/strict"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt">
<xsl:variable name="_MetaData">
<MetaData>
<EmployeeId>1233</EmployeeId>
<EmployeeName>abcd</EmployeeName>
</MetaData>
</xsl:variable>
<xsl:variable name="MetaData" select="msxsl:node-set($_MetaData)"></xsl:variable>
<xsl:template match="*|@*">
<xsl:copy>
<xsl:copy-of select="@*" />
<xsl:apply-templates />
</xsl:copy>
</xsl:template>
<xsl:template match="*[local-name()='MetaDataTag']">
<xsl:copy>
<MetaData VocabularyOwner="acme.com" Vocabulary="MetaData">
<xsl:for-each select="$MetaData//MetaData/*">
<xsl:element name="Occurrence">
<xsl:attribute name="Id">
<xsl:value-of select="local-name(.)"/>
</xsl:attribute>
<xsl:attribute name="Value">
<xsl:value-of select="string(.)"/>
</xsl:attribute>
</xsl:element>
</xsl:for-each>
</MetaData>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
はXML:
<?xml version="1.0" encoding="utf-8" ?>
<Envelope>
<MetaDataTag />
</Envelope>
私は= "http://www.w3.org/TR/xhtml1/strict" 名前空間のxmlnsのxmlnsを削除すると、すべてがそうですうまく動作し、私はループの中に入ることができます。 xmlns = "http://www.w3.org/TR/xhtml1/strict"名前空間を削除せずにこの問題を解決する方法がわかりません。