[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Getting the Keys right for 2nd level grouping
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
|
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
|