Re: [xsl] Value of variable not appearing in the <xsl:otherwise> of xml:choose

Subject: Re: [xsl] Value of variable not appearing in the <xsl:otherwise> of xml:choose
From: "Michael Kay mike@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 22 Sep 2021 17:46:05 -0000
> Especially if you find Wendell's observation above covers your use
> cases, it won't apply this time, but in general, I find that if I'm
> struggling with xsl:for-each-group, I should -- and sometimes I even do!
> -- remember that xsl:for-each-group is not fully general. There comes a
> time to write one's own recursive grouping function for this particular
> case.
>

I've found very few use cases that it doesn't cover, though XQuery windowing
offers a lot of options that xsl:for-each-group doesn't, and perhaps they're
useful to someone... Such as starting a new group whenever @x on the current
item is less than @x on the previous item. Sometimes you can handle these by
binding a variable to the items that match the condition, and then using this
variable in your group-starting pattern.

Michael Kay
Saxonica

Current Thread