Subject: Re: Apply for-each-group to a node subset
From: Raman Gupta <rocketraman@xxxxxxxxxxx>
Date: Fri, 21 Sep 2007 12:53:19 -0400
|
Tony Graham wrote:
> It may be simpler if you do it all using ">>":
>
> <xsl:template match="r">
> <xsl:copy>
> <xsl:apply-templates select="*[../g1[1] >> .]"/>
> <xsl:for-each-group
> select="g1[1] |
> *[(. >> ../g1[1]) and (../g2[last()] >> .)] |
> g2[last()]"
> group-ending-with="g2">
> <group>
> <xsl:apply-templates select="current-group()"/>
> </group>
> </xsl:for-each-group>
> <xsl:apply-templates select="*[. >> ../g2[last()]]"/>
> </xsl:copy>
> </xsl:template>
Aha! Very nice. Your other email also presented a very easy to
understand solution. Thanks to both Tony and Abel.
Cheers,
Raman
|