How do I rename XML tags using XSLT

后端 未结 1 796
不知归路
不知归路 2020-12-15 18:54

This is my XML-


    C1
    
    Empire Burlesque
    Bob Dylan&l         


        
相关标签:
1条回答
  • 2020-12-15 19:35

    Use the identity transform with overrides for the elements you want to rename:

    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
        <xsl:template match="@*|node()">
            <xsl:copy>
                <xsl:apply-templates select="@*|node()" />
            </xsl:copy>
        </xsl:template>
        <xsl:template match="CD/NAME">
            <CD-NAME><xsl:apply-templates select="@*|node()" /></CD-NAME>
        </xsl:template>
        <xsl:template match="CATALOG/NAME">
            <CATALOG-NAME><xsl:apply-templates select="@*|node()" /></CATALOG-NAME>
        </xsl:template>
    </xsl:stylesheet>
    
    0 讨论(0)
提交回复
热议问题