Re: [xsl] Navigating <xsl:for-each-group> groups

Subject: Re: [xsl] Navigating <xsl:for-each-group> groups
From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 13 Nov 2015 15:00:58 -0000
Rick Quatro rick@xxxxxxxxxxxxxx wrote:
As I am processing a for-each-group, I want to check some of the elements
within the group that are before or after the current node. I can use
preceding-sibling and following-sibling axes, but it doesn't seem like these
are restricted to the current-group. Is there a good way to query what is
before or after the current node of a group, while insuring that the query
stays within the group? Thanks. -Rick

If you process the current-group() with e.g.
<xsl:for-each select="current-group()">
<xsl:variable name="pos" select="position()"/>
<xsl:variable name="prec" select="current-group()[position() lt $pos]"/>
<xsl:variable name="foll" select="current-group()[position() gt $pos]"/>
or use the same approach with <xsl:apply-templates select="current-group()"/> then you can access the items in a group preceding or following the current item in the group.

Current Thread