Re: Keys and select distinct - is that the solution ?
Personally I think the "Muenchian method" is only difficult because we treat it as if it were difficult.
All it does is
* select one representative node from each group (usually the first in document order) * iterate over this set * with each representative, process the rest of its group
The only reason it's hard at all is that in order to do these things efficiently in XSLT 1.0 we have to do things like node-identity tests (are you the first node in the group to which you belong?), which are just a bit tricky. Steve's particular contribution was to use keys for indexing, making expensive tree-traversals unnecessary when doing this. The basic algorithm might be clearer and easier to understand if we did it without keys -- but the efficiency gains are so enormous that we almost always have to use them. Hence the Muenchian method becomes "standard" even while it is somewhat more opaque (beginners often find keys a bit much to take in), and looks more complicated than it actually is.
It may be worth $45 to learn, but that's hardly the going market rate. Many many people have learned it for free.
As for "the man himself", Steve is nothing but gracious, and would probably be first to acknowledge that although he conceived the solution (or rather, imaginatively applied it from another domain: see http://www.biglist.com/lists/xsl-list/archives/200005/msg00270.html), it also emerged from within the context of a community-wide effort to address a number of variously-related transformation requirements including grouping, in which many other people played significant roles (including several still active here such as Mike Kay, David Carlisle, Ken Holman -- read the archives and FAQ to see who).
The first three or four years of XSLT were lots of fun, and a very impressive demonstration of how much more powerful than one mind (even one mind like those mentioned above) can be many working cooperatively.
At 07:29 PM 6/2/2006, you wrote:
Christian Rasmussen <christiankrasmussen@xxxxxxxxx> writes:
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format