[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: XSL Sorting Question - Meunchian Method

Subject: Re: XSL Sorting Question - Meunchian Method
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Thu, 8 Nov 2001 09:35:15 +0000
Re:  XSL Sorting Question - Meunchian Method
Hi Brian,

Just to annotate Steve's solution - the important thing with the
Muenchian grouping method is that to get a list of the unique values
you need one entry in the key (one matched element) for each possible
value. A key like:

<xsl:key name="cust4proj" match="PROROW" use="project_name"/>

will only be able to get you unique project_name values if there's
only one project_name under each PROROW, which in your case there
isn't. So you have to use:

<xsl:key name="proj" match="project_name" use="."/>

where you can guarantee that each project_name element will only be
indexed under its particular value.

The reason this matters is apparent if you look at the expression you
have to use to get the unique values. If you did:

  PROROW[generate-id() =
         generate-id(key('cust4proj', project_name)[1])]

the call to the key for a particular PROROW would retrieve all the
PROROWs that have the same project_name as *any* of the project_names
under the particular PROROW. You need the call to the key to retrieve
only one group, which is what:

  PROROW/project_name[generate-id()
                      generate-id(key('proj', .)[1])]

does.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.