[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Grouping: Number of groups

Subject: Re: [xsl] Grouping: Number of groups
From: Michael Kay <mike@xxxxxxxxxxxx>
Date: Fri, 14 Sep 2012 15:13:26 +0100

I would suggest putting the result of the grouping in a variable, and then processing the variable:

<xsl:variable name="temp">
<xsl:for-each-group ....>

then count($temp/group)

Michael Kay

On 14/09/2012 14:08, Norbert Heidbrink wrote:
Hi everybody,

is there a way to retrieve the number of groups that have been found by
<xsl:for-each-group> outside this instruction?

XML: <line> v <tab /> w <tab /> x <tab /> y <tab/> z <line>

(v, w, x, y, z being mixed data)

<xsl:for-each-group select="node()" group-ending-with="tab"> b& here, the function last() gives me the number I want, but b& </xsl:for-each-group> b& I need the figure here. b&

Maybe I am entirely on a false track?

What I want is:
(1) if there are less than n groups do something afterwards.
(2) If there are more than m groups do something different.

Thanks for your answers, Norbert

Current Thread