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

Re: [xsl] things about grouping

Subject: Re: [xsl] things about grouping
From: David Carlisle <davidc@xxxxxxxxx>
Date: Sat, 24 Nov 2012 22:43:58 +0000

On 24/11/2012 05:54, Ihe Onwuka wrote:
1. <xsl:apply-templates select="current-group() except blah"/>

still applies templates to blah

well current-group() except blah selects all nodes in the current group except blah nodes that are children of the current node. so it won't apply templates to "blah" if blah is interpreted as a relative xpath
from the current node. If you mean don't select elements in the current group that match blah then


is probably as clear as any of the alternatives.

2. If your group by patttern evaluates to an empty element current-grouping-key() will yield nothing. However one may (as I did) want to get at the attributes of such an element but this is not possible.

group-by takes an expression rather than a pattern (starting-with and ending-with take patterns) the sorting key will be the empty string in that case and should be usable just as any other string.

3. If you group-starting-with it's weird to then see things not encompassed by the starting-with expression appear as a group because they precede the first occurrence of the starting-with expression. While this works as specified because for-each-group is a total function over the population it does result in a mismatch between the grammatical semantic and the exhibited behaviour, or to put it another way it does what it says in the spec but doesn't do what it says on the tin.

If using starting-with you pretty much always end up testing if . matches the starting pattern and if so you are in the "bit before the first section"


google plus: https:/profiles.google.com/d.p.carlisle

Current Thread