我有这个XML文件:
<Response>
<errorCode>error Code</errorCode>
<errorMessage>msg</errorMessage>
<ResponseParameters>
<className>
<attribute1>a</attribute1>
<attribute2>b</attribute2>
</className>
</ResponseParameters>
</Response>
Run Code Online (Sandbox Code Playgroud)
我希望输出为:
<className>
<attribute1>a</attribute1>
<attribute2>b</attribute2>
</className>
Run Code Online (Sandbox Code Playgroud)
我当前的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>
Run Code Online (Sandbox Code Playgroud)
Dim*_*hev 15
用途:
<xsl:copy-of select="/Response/ResponseParameters/node()"/>
Run Code Online (Sandbox Code Playgroud)
该"//"缩写是非常昂贵(导致要扫描的完整的XML文档),并且应该避免.
| 归档时间: |
|
| 查看次数: |
16552 次 |
| 最近记录: |