将节点集从Keys复制到Variable

时间:2011-06-08 07:31:00

标签: xslt

我有一把钥匙: <xsl:key name="colorNumKey" match="color" use="@id"/>

我知道密钥中有5个节点集(5个不同的<colour>元素)。是否可以在变量中复制这5个节点集?所以我可以使用Variable nodeset进行处理。

1 个答案:

答案 0 :(得分:0)

有可能。怎么做,这实际上取决于背景。

示例,在color父级(简称colors)的上下文中,您可以使用:

<xsl:template match="colors">
 <xsl:variable name="children" select="key('colorNumKey',*/@id)"/>
 <!-- use $children -->
</xsl:template>