1

カスタムの方法で xslt 1.0 にルート ノードを作成したい

期待される

" < TESTROOT xmlns="http://www.example.org/TESTXMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www. example.org/TESTXMLSchema TESTEntry.xsd">

実際

" < TESTROOT xsi:schemaLocation="http://www.example.org/TESTXMLSchema TESTEntry.xsd" xmlns="xmlns="http://www.example.org/TESTXMLSchema"" xmlns:xsi="http:/ /www.w3.org/2001/XMLSchema-instance">

事前にご協力いただきありがとうございます

よろしく ラメシュクマール・シン

4

1 に答える 1

3

これと同じくらい簡単です:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 <xsl:output omit-xml-declaration="yes" indent="yes"/>

 <xsl:template match="/">
  <TESTROOT xmlns="http://www.example.org/TESTXMLSchema"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
            xsi:schemaLocation="http://www.example.org/TESTXMLSchema TESTEntry.xsd">
    The results of your processing here ...
  </TESTROOT>
 </xsl:template>
</xsl:stylesheet>

この変換が任意の XML ドキュメント (使用されていない) に適用されると、必要な結果が生成されます。

<TESTROOT xmlns="http://www.example.org/TESTXMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.example.org/TESTXMLSchema TESTEntry.xsd">
    The results of your processing here ...
  </TESTROOT>
于 2012-10-16T15:13:00.017 に答える