XSLTを学んでいます。この投稿 @Rich のアドバイスに従って、ノードをノードに変換しようとしています。How to replace a node-name with another in Xslt?
ここに私の入力XMLがあります:
<ns:positionSkillResponse xmlns:ns="http://positionskillmanagementservice.webservices.com">
<ns:return>1</ns:return>
<ns:return>9</ns:return>
</ns:positionSkillResponse>
以下のコードで変換しようとしていますが、パーサー エラーが発生しています。ns:return が問題だと思います。これは、トランスフォーマー コードが名前空間 ns を解決する方法を認識していないためです。しかし、名前空間は URL に公開されていないため、そこに指定することはできません。それが問題ですか?私は何をしますか?
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:
version="1.0">
<xsl:output method="xml" />
<xsl:template match="ns:return">
<parameter>
<xsl:apply-templates select="@*|node()"/>
</parameter>
</xsl:template>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
結果:
Error:XSLTProcessor::transformToXml() [<a href='xsltprocessor.transformtoxml'>xsltprocessor.transformtoxml</a>]: No stylesheet associated to this object