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

Getting the Keys right for 2nd level grouping

Subject: Getting the Keys right for 2nd level grouping
From: "KUMAR NINGASHETTY" <kningashetty@xxxxxxxxxxxxxxxx>
Date: Tue, 23 Jul 2002 12:01:06 -0400
keys.right
Hi everybody ...
   I didnt really verify if this was  discussed earlier coz i am in a hurry .But  I am half way through solving a problem and some small 
   hint will do .
   Here is my XSL with first level grouping extracting distinct regions   and i am having problems grouping users with Region Nodeset.
  Any help appreciated .
  Following is  XSL (presently pulling distinct regions ) .. an Examle XML and  expected result .
Note : I applied Keys to do 2nd level for users  but i was able to pull out only 1 row in each region where as 
          there are many userid's as shown below.

 _______________My  XSL _____________________

<xsl:key name="distinct-region" match="*" use="@reg"/>


<xsl:template match="/">

   <xsl:for-each select="rep/uwr/los[@reg][generate-id()=generate-id(key('distinct-region', @reg))]">

	<xsl:value-of select="@reg"/>
    </xsl:for-each>
 </xsl:template>


_________________XML______________________________

<rep>
  <uwr>
	<los userid="1014" reg="Region 4">
		<review type="N"><![CDATA[11]]></review>
		<review type="Y"><![CDATA[16]]></review>
	</los>
	<los userid="1017" reg="Region 4">
		<review type="N"><![CDATA[7]]></review>
		<review type="Y"><![CDATA[17]]></review>
	</los>
	<los userid="1025" reg="Region 2">
		<review type="N"><![CDATA[13]]></review>
		<review type="Y"><![CDATA[12]]></review>
	</los>
  </uwr>
  <arr>
	<los userid="1014" reg="Region 4">
		<review type="N"><![CDATA[15]]></review>
		<review type="Y"><![CDATA[19]]></review>
	</los>
	<los userid="1017" reg="Region 4">
		<review type="N"><![CDATA[20]]></review>
		<review type="Y"><![CDATA[22]]></review>
	</los>
	<los userid="1025" reg="Region 2">
		<review type="N"><![CDATA[23]]></review>
		<review type="Y"><![CDATA[25]]></review>
	</los>
  </arr>
</rep>

____________Expected Result__________________________

Region 4
    Userid  UWR(N)  UWR(Y)   ARR(N)     ARR(Y)
    1014          11       16               15          19
    1017           7        17              20           22
    
Region 2
   Userid    UWR(N)  UWR(Y)   ARR(N)   ARR(Y)
    1025       13             12             23          25


Thanks  
- Kumar
    



 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.