xsl-list
[Top] [All Lists]

Re: [xsl] things about grouping

2012-11-24 16:44:23
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

current-group()[not(self::blah)]

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"

David



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

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>