只需在
count()
上使用 key()
。
示例(将
count
属性添加到 group
)...
<xsl:template match="element">
<group name="{@name}" count="{count(key('PC',@name))}">
<xsl:for-each select="key('PC',@name)">
<item>
<xsl:value-of select="@value"/>
</item>
</xsl:for-each>
</group>
</xsl:template>