输入xml- 父节点块再次出现三次。我需要完全删除重复的节点,即使它在同一xml中出现了7次以上而没有创建新的xml
<Blocks>
<Block>
<Name>Table</Name>
<Value>wood</Value>
</Block>
<Block>
<Name>Chair</Name>
<Value>Plastic</Value>
</Block>
<Block>
<Name>Table</Name>
<Value>wood</Value>
</Block>
<Block>
<Name>Table</Name>
<Value>wood</Value>
</Block>
</Blocks>
执行后:
<Blocks>
<Block>
<Name>Table</Name>
<Value>wood</Value>
</Block>
<Block>
<Name>Chair</Name>
<Value>Plastic</Value>
</Block>
</Blocks>
答案 0 :(得分:0)
<xsl:template match="Blocks">
<Blocks>
<xsl:for-each-group select="Block" group-by="Name">
<xsl:sequence select="."/>
</xsl:for-each-group>
</Blocks>
xslt 2.0