导航

用 XSL 重命名 XML tag name[yysun]

Posted on 2004-11-02 23:15  yysun  阅读(1008)  评论(0编辑  收藏  举报

<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>
<xsl:template match='/'>
    <xsl:apply-templates select='@*|node()'/>
</xsl:template>
<xsl:template match='@*|*'>
    <xsl:copy><xsl:apply-templates select='@*|node()'/></xsl:copy>
</xsl:template>
<xsl:template match='{0}'>
<xsl:element name='{1}'>
    <xsl:apply-templates select='@*|node()' />
</xsl:element>
</xsl:template>
</xsl:stylesheet>

{0} - old tag name
{1} - new tag name