Hi Andrew:
Ive found out, the hard way, that current-group-key() works only for group-by and group-adjacent, not for group-starting-with and group-ending-with.

Hi Michael:
Yes, youre right on target, thats exactly what I meant. Why do I long for such a function(ality)?

1) I tend to use rather complex grouping patterns, and oftentimes I nest "group-ending-with" within "group-starting-with" constructs, so this would help me cut down the verbosity and consequently programming errors as well

2) I have the impression (might be wrong of course) that such a function would make my stylesheets run faster, in my case maybe a lot faster due to reason in item 1 (above)

3) I gather that this "status or information" about the current group is already available as the groups are being built, so, why not make it into a function, available in the stylesheet itself?

4) Grouping within XSLT seems to be such a complete solution, with so many facilities and even niceties, that I just cant help but feel that this function should be there already, it sure does seems logical to me. Take for instance, the current-grouping-key() function mentioned by Andrew (first part of this reply). When you "group-by" or "group-adjacent" the current-grouping-key() function just begs to exist. When you "group-starting-with" and "group-ending-with", since you already know what the "grouping-key" is, the function that begs to exist is a function that tells me if the current-group matches (or not) the grouping criteria.

Mike, IMHO, those are good enough arguments. I do appreciate, of course, your insights, so Im looking forward to your reply...


On 6/22/06, andrew welch <andrew.j.welch@gmail.com> wrote:
On 6/22/06, Michael Kay <mike@saxonica.com> wrote:
> Presumably you mean you want to know if the current item matches the
> group-starting-with pattern? As in
> <xsl:for-each-group select="*" group-starting-with="H2">
>   <xsl:if test="self::H2">...
> I tend to use the above style (repeating the test) if it's a simple pattern,
> or I might use
> <xsl:if test="position()=1">...
> They're not quite the same thing, of course, in that the first item in the
> first group doesn't necessarily match the pattern.
> I'd say my view on this is: you have a point, but it would need a strong
> argument to justify adding an extra function to the spec or an extension
> function to Saxon.

What does current-grouping-key() return in this case?  I would've
thought you could do something like:

test=". is current-grouping-key()"

...if current-grouping-key() magically returned a node in this case.

Just a thought.

All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
saxon-help mailing list

A coisa certa dita na hora errada
pior do que
a coisa errada dita na hora certa...