Subject: Re: [xsl] XSL Sorting Question - Meunchian Method From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx> Date: Thu, 8 Nov 2001 09:35:15 +0000 |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] XSL Sorting Question - Me, Steve Muench | Thread | [xsl] How to get unique data, Rick Zhang |
RE: [xsl] Q on ISO TimeDate convert, Michael Kay | Date | Re: [xsl] [ANNOUNCE] UWOBO 1.2.0 re, Claudio Sacerdoti Co |
Month |