我有一把钥匙:
<xsl:key name="colorNumKey" match="color" use="@id"/>
。
我知道密钥中有5个节点集(5个不同的<colour>
元素)。是否可以在变量中复制这5个节点集?所以我可以使用Variable nodeset进行处理。
答案 0 :(得分:0)
有可能。怎么做,这实际上取决于背景。
示例,在color
父级(简称colors
)的上下文中,您可以使用:
<xsl:template match="colors">
<xsl:variable name="children" select="key('colorNumKey',*/@id)"/>
<!-- use $children -->
</xsl:template>