我有这个 XML 文件:
<Response>
<errorCode>error Code</errorCode>
<errorMessage>msg</errorMessage>
<ResponseParameters>
<className>
<attribute1>a</attribute1>
<attribute2>b</attribute2>
</className>
</ResponseParameters>
</Response>
我希望输出是:
<className>
<attribute1>a</attribute1>
<attribute2>b</attribute2>
</className>
我当前的 XSL 文件还包括我不想要的“ResponseParameters”标签。
编辑:请注意,节点 className 是动态的。我不知道运行时这个名称是什么。
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output indent="yes" />
<xsl:template match="/">
<xsl:copy-of select="//ResponseParameters">
</xsl:copy-of>
</xsl:template>
</xsl:stylesheet>
Use :
<xsl:copy-of select="/Response/ResponseParameters/node()"/>
The "//"
缩写非常昂贵(导致扫描完整的 XML 文档),并且应该避免.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)