0
我正在尝试使用xslt转换xml代码。 下面是我的XML的谢灵运:我想将其转换成像这样使用xslt创建元素及其值的副本
<Response>
<Case>
<CaseID>...</CaseID>
...
<BillStatusCode typecode="1">type description</BillStatusCode>
</Case>
</Response>
:
...
<BillStatusCode>
<BillStatusCode>type description</BillStatusCode>
<typecode>1</typecode>
</BillStatusCode>
XSLT代码:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="@*">
<xsl:element name="{name()}">
<xsl:value-of select="."/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
它给了我这样的输出:
<Response>
<BillStatusCode>
<typecode>1</typecode>type description</BillStatusCode>
</Response>
希望对此有帮助。谢谢!
请解释转型背后的逻辑在这里发表您的XSLT。 – 2015-04-06 12:02:00
我编辑了我的问题。 – 2015-04-06 12:11:39