Re: [xsl] mixed content grouping by whitespace

Subject: Re: [xsl] mixed content grouping by whitespace
From: "Imsieke, Gerrit, le-tex" <gerrit.imsieke@xxxxxxxxx>
Date: Tue, 13 Apr 2010 21:27:18 +0200
On 13.04.2010 20:17, David Carlisle wrote:
On 13/04/2010 19:08, Wendell Piez wrote:
only a mathematician is likely to find this more straightforward than
group-starting-with="h2". At least most of the time.

Are there other people?

My maths tutor used to say: In mathematics, you learn either by insight or by habituation. It is only by habituation that I learned the distinction between patterns and expressions in grouping conditions. I never fully understood why in g-s-w/g-e-w groupings the population needs to be all nodes and not arbitrary sequences. I wonder whether it is because someone insisted that g-s-w/g-e-w conditions need to be patterns and hencefore the population need to be nodes, or whether it was the other way round. Maybe it is as it is for "historical reasons". Or maybe they thought: if we permit an arbitrary expression as g-s/e-w condition then we must check that an effective boolean value may be calculated for this expression, because it should be a yes/no decision whether a given item starts/ends a group. Maybe they found that a pattern that either matches or not is a more clear-cut and comprehensible binary criterion than arcane EBV semantics, at least for the common case of grouping nodes. I can imagine that they wanted to have patterns for all grouping conditions and very reluctantly accepted the fact that there must be more key values than true or false for group-by and group-adjacent.
I doubt that implementation considerations (such as a fictional: "a pattern match will typically be evaluated faster") have guided the decision.
To start a more general discussion: what are patterns for anyway? Couldn't the matching in template rules be performed by evaluating the EBV of an arbitrary expression in the match attribute? I think this wouldn't be XSLT (transforming nodes) any more if a template could match, for example, anything that is castable as xs:double.
But for g-s/e-w, I think an expression does make sense. If the expression's EBV (the EBV of the result of evaluating the expression, to be more precise) cannot be calculated, a type error will be raised. That's ok.


Only my 2 xs:currency.

Gerrit

Current Thread