[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] 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
|
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
|