Subject: Re: [xsl] Sorting and Grouping Alphabetically: Two Levels From: David Carlisle <davidc@xxxxxxxxx> Date: Tue, 8 Jan 2008 17:03:18 GMT |
> So sorry. x:node-set() is not available. blugh which processor are you using? > I realize that the display I represented requires the > extra mark-up and I can easily put that in later the structure of the xslt for text is (or can be) very different. Consider just one step of your problem adding a blank line between letters (assuming sorting is done. If you are just generating text, you don't need to group anything, you just need to put out a blank line every now and then <xsl:for-each seelct="*"> <xsl:value-of select="."/> <xsl:if tests="not(substring(.,1,1)=substring(following-sibling::*[1],1,1))"> </xsl:if> </xsl:for-each> If however you need to produce markup, say putting all the rows that start with the same letter in a div then you need to group all the elements that start with the same letter together so in xslt 2 <xsl:for-each-group group-by="substring(.,1,1)"> <div> <xsl:copy-of select="current-group()"/> </div> </xsl:for-each-group> or, as we used to write it in xslt 1, <xsl:key name="l1" match="*" use="substring(.,1,1)"/> <xsl:for-each select="*[generate-id()=generate-id(key('l1',substring(.,1,1)))]"> <div> <xsl:copy-of select="key('l1',substring(.,1,1))"/> </div> </xsl:for-each> David
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Sorting and Grouping Alph, Wei, Alice J. | Thread | RE: [xsl] Sorting and Grouping Alph, Trish |
Re: [xsl] Return value from a templ, Eric Bréchemier | Date | RE: [xsl] Sorting and Grouping Alph, Trish |
Month |