On 3/8/07, David Carlisle <davidc(_at_)nag(_dot_)co(_dot_)uk> wrote:
> unless Saxon performs some smart optimization. What do you think ?
even if you don't use a key saxon (perhaps just in the -sa version, I
can't remember) may decide you use some //foo[(_at_)x='aa'] idiom often
enough to internally use a key anyway. I tend to think of for-each group
as a sane syntax added at xslt2 for the muenchian grouping idiom that
Dimitre showed, which works well, but only looks normal as its posted
once a week for over half a decade to this list:-). No idea if the
internal implementations are similar though but that's processor
specific detail...
.
Completely agree with David.
Not speaking about performance but about *style* and expressiveness,
there are some interesting things to note:
1. No need to explicitly specify recursion in the "keys" aproach.
2. No need to pass parameters using the "keys" approach-- most of
the work is being done as one atomic operation -- the one-time
creation of the index
3. Some purists will comment that <for-each-group/> supports the
"more imperative-like", "pull" style of using <xsl:for-each/> as
contrasted with the more general and flexible push-style
<xsl:apply-templates/>
4. The"keys" approach works without any change both in XSLT 1.0 and XSLT 2.0
Threfore, one might conclude that the "keys" approach can be
implemented in a more compact and flexible way and the resulting
implementations can be more maintainable.
--
Cheers,
Dimitre Novatchev
---------------------------------------
Truly great madness cannot be achieved without significant intelligence.
---------------------------------------
To invent, you need a good imagination and a pile of junk
-------------------------------------
You've achieved success in your field when you don't know whether what
you're doing is work or play
--~------------------------------------------------------------------
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>
--~--