At 05:32 AM 10/13/2006, Andrew wrote:
On 10/13/06, Webmaster <Webmaster(_at_)comtrol(_dot_)com> wrote:
Hi.All.
Thank you for your responses. It was really hard for me to explain my
situation, but I think you understood the question. I'm using XSL1.0, and am
pursueing the muechian method. And consequently pulling my hair out.
I'll let you know how it turns out.
The Muenchian technique is really hard to understand until the penny
drops and you realise what all the generate-id()'s are for :)
This is quite true.
And what is the generate-id() for? To see if the nodes returned by
two different expressions, for example
1. . (i.e., the context node)
2. key('items-by-group',$item-key)[1] (i.e., the first node in a
given group, in document order)
are in fact the same node.
Actually what is "Muenchian" about the Muenchian method (though only
keen historians of XSLT will ever know this) is not the grouping
method itself, but the recognition that expression 2 can be used
instead of this:
3. /descendant::item[(_at_)group=$item-key][1]
or, if you prefer, (//item[(_at_)group=$item-key])[1]
which work just as well in theory, but not in practice, as (a) these
are harder for an XSLT processor to optimize to run fast (as
$item-key isn't static), and (b) if it is not optimized, it scales
far worse than expression 2. Using a key is in effect a way of
optimizing the process by hand.
Once you get it though, you also get a whole raft of concepts that
really help in other areas of XSLT, so persevere with it and if you
get stuck post back.
That's also true.
The Muenchian method is also tricky because it's actually two or
three separate non-obvious techniques used together. They'd be much
easier to learn separately. But the "how" and the "why" can be
distinguished; the method can basically be boiled down to
1. Grabbing a set of nodes according to a given selection criterion
for grouping;
2. Grabbing all the available sets by grabbing all the nodes and
filtering them, keeping only one member (typically the first in
document order) from each set;
3. Using techniques for doing these that are reasonably performant
and scalable over larger data sets, at the price of being somewhat opaque.
It would be much easier to learn that you were doing 1 and 2 if you
didn't have to worry about 3. And again, 3 is the only part that is
really "Muenchian", but the performance gains are so enormous that
expert practitioners rarely or never bother with 1 and 2 without it.
Cheers,
Wendell
--~------------------------------------------------------------------
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>
--~--