Subject: [xsl] Grouping From: Andy.Stephen@xxxxxxxxxxxxxxxxxxx Date: Wed, 11 Jun 2003 09:16:45 +0100 |
******************************************************************************************************************************************************* This email and any files transmitted with it are intended solely for the use of the individual or entity to whom they are addressed. ******************************************************************************************************************************************************* Vendor: Microsoft Processor version: Original IE5 (or old version of other processor) Hi, I'm fairly new to XSLT and have been having a problem with an XML file I'm trying to process, the file being something along the lines below <?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="andytest.xsl"?> <Resources> <resource> <filename Dept="A" LastModified="10/03/2003" NextReview="10/04/2003" Stale="More Than Month Overdue"> Filename title </filename> <author> Joe </author> <readers/> <Div Head> A </Dept Head> <Division> A </Division> </resource> <resource> <filename Dept="A " LastModified="30/04/2003 14:02 " NextReview="31/05/2003 " Stale="Up To Month Overdue"> Filename title </filename> <author> Jill </author> <readers/> <Div Head> Person B </Div Head> <Division> Div B </Division> </resource> <resource> <filename Dept="A" LastModified="17/04/2003" NextReview="29/05/2003" Stale="Up To Month Overdue"> Filename title </filename> <author> Sam </author> <readers/> <Div Head> Person C </Div Head> <Division> A </Division> </resource> <resource> <filename Dept="B" LastModified="30/05/2003" NextReview="01/07/2003" Stale="More Than Week To Go"> Filename Title </filename> <author> Alice </author> <readers> <reader count="1"> Bloggs J (Joe) </reader> <reader count="1"> Bloggs S (Sam) </reader> <reader count="1"> Bloggs J (Jim) </reader> </readers> <Div Head> Person A </LeadMinister> <Division> C </Division> </resource> </Resources> need to end up with Group by Dept: Group By Division: Group By Author Dept - Division - Author ---------------------------------------------- A - A - Joe - - Sam - B - Jill B - C - Alice The problem I'm having is I'm trying to use Meunchian grouping and while I can get the first grouping using <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml" version="1.0"> <xsl:output indent="yes" method="html"/> <xsl:key name="resources-div" match="resource" use="Division" /> <xsl:template match="/"> <html> <head></head> <body> <xsl:apply-templates /> </body> </html> </xsl:template> <xsl:template match="Resources"> <xsl:for-each select="//resource[generate-id(.)=generate-id(key('resources-div',Division)) ]"> <xsl:value-of select="Division" /> <xsl:for-each select="key('resources-div',Division)"> </xsl:for-each> </xsl:for-each> </xsl:template> </xsl:stylesheet> I'm having great trouble getting the second grouping and so on to work, I've experimented with a few different formats but haven't quite got there (or got there at all) so I was hoping someone would be able to give me a few pointers to get me in the right direction. Andy Stephen Analytical Services Tel: 2440796 XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] xhtml and different names, Joe Fawcett | Thread | RE: [xsl] Grouping, Jarno . Elovirta |
[xsl] xhtml and different namespace, Björn Boxstart | Date | Re: [xsl] xhtml and different names, Joe Fawcett |
Month |