2

次のXMLがあります

<?xml version="1.0"?>
<location>
<Destination>Des01</Destination>
<DesCode>ACD8701</DesCode>
<UniqueId>023154</UniqueId>
<Amount>26</Amount>
</location>

<location>名前空間を変更して追加したい<abc_ItemUpdate>ので、XSLT を使用した後の出力は次のようになります。

<ns0:abc_ItemUpdate xmlns:ns0="http://schemas.microsoft.com/Sql/2008/05/TypedProcedures/dbo">
    <ns0:Destination>Des01</ns0:LegalEntity>
    <ns0:DesCode>ACD8701</ns0:DesCode>
    <ns0:UniqueId>023154</ns0:UniqueId>
    <ns0:Amount>26</ns0:Amount>
</ns0:abc_ItemUpdate>

前もって感謝します

4

1 に答える 1

2
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <xsl:output indent="yes"/>

 <xsl:template match="/location">

     <xsl:element name="ns0:abc_ItemUpdate" namespace="http://yournms">
         <!-- copy attributes if any -->
         <xsl:copy-of select="@*"/>
         <xsl:apply-templates/>
     </xsl:element>

 </xsl:template>

 <xsl:template match="*">
     <xsl:element name="ns0:{name()}" namespace="http://yournms">
         <!-- copy attributes if any -->
         <xsl:copy-of select="@*"/>
         <xsl:apply-templates/>
     </xsl:element>
 </xsl:template>

</xsl:stylesheet>
于 2012-06-12T22:33:00.410 に答える