统计XSLT中分组后的元素数量

问题描述 投票:0回答:1
xslt count grouping
1个回答
0
投票

只需在

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>
© www.soinside.com 2019 - 2024. All rights reserved.