This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Acheiving ..2nd level grouping but with different node structure ..
- From: Jeni Tennison <jeni at jenitennison dot com>
- To: "KUMAR NINGASHETTY" <kningashetty at deltafunding dot com>
- Cc: xsl-list at lists dot mulberrytech dot com
- Date: Wed, 24 Jul 2002 14:19:15 +0100
- Subject: Re: [xsl] Acheiving ..2nd level grouping but with different node structure ..
- Organization: Jeni Tennison Consulting Ltd
- References: <sd3e6ca2.044@deltafunding.com>
- Reply-to: xsl-list at lists dot mulberrytech dot com
Hi Kumar,
> Here is my XSL with first level grouping extracting distinct regions
> and i am having problems grouping users within Region .
The secret of 2nd level grouping with the Muenchian method is to
create keys that combine the two things that you want to group by.
Your first level key is:
<xsl:key name="distinct-region" match="*" use="@reg"/>
(Though I think it would be better as:
<xsl:key name="distinct-region" match="los" use="@reg"/>
since that would limit it to only holding los elements.)
So your second level key should be something along the lines of:
<xsl:key name="distinct-region-and-user" match="los"
use="concat(@reg, '+', @user)" />
Then, given that you've found a region ($reg), you can get all the
unique users in that region with:
key('distinct-region', $reg)
[generate-id() =
generate-id(key('distinct-region-and-user',
concat($reg, '+', @user)))]
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list