我刚刚写了一个起初不起作用的XSLT.
我不得不重新命名的所有儿童<Recordset>
到<C>
:
<?xml version="1.0" encoding="utf-8"?>
<Record>
<Recordset>
<company>102</company>
<store>1801</store>
....
</Recordset>
<Recordset>
....
</Recordset>
</Record>
Run Code Online (Sandbox Code Playgroud)
我使用了以下XSLT:
<xsl:template match="Record/Recordset/child::*">
<xsl:element name="C">
<xsl:apply-templates select="@*|node()"/>
</xsl:element>
</xsl:template>
Run Code Online (Sandbox Code Playgroud)
它的工作原理和重命名的所有孩子<Recordset>
来<C>
.但首先我在模板中的匹配看起来像这样:
<xsl:template match="Record/Recordset/child::node()">
Run Code Online (Sandbox Code Playgroud)
我的想法是每个孩子<Recordset>
都是一个节点,因此node()
是合适的.它也有效,但它<C/>
为每个孩子插入了额外的东西.
child::node()
和之间有什么区别child::*
?
xslt ×1