Subject: Re: [xsl] Complicated grouping and column question From: David Carlisle <davidc@xxxxxxxxx> Date: Wed, 29 Jun 2005 22:40:39 +0100 |
<xsl:apply-templates select="/schedule/division[substring(@name,1,1) = $current-letter]"> No need to search the entire file again to find these, the divisions with that letter are the current-group() and have already been collected up by for-each-group. I'd do your sorting/grouping first then split in to two later: <xsl:template name="make-index"> <xsl:variable name="x"> <ul> <xsl:for-each-group select="/schedule/division" group-by="substring(@name,1,1)"> <xsl:sort select="current-grouping-key()" /> <xsl:variable name="current-letter" select="current-grouping-key()" /> <li> <h2><xsl:value-of select="$current-letter" /></h2> <ul> <xsl:apply-templates select="current-group()"> <xsl:sort select="@name" /> </xsl:apply-templates> </ul> </li> </xsl:for-each-group> </ul> </xsl:variable> <!-- the number of li's at any level with text as an approximation of line counts--> <xsl:variable name="c" select="count($x//li[text()]) div 2"/> <!-- the top level (letter) li that has the half way point --> <xsl:variable name="letter2" select="$x/descendent::li[$c]/ancestor::li[last()]"/> <!-- copy the half way letter and its older siblings into one td and the later ones into the second td. --> <table> <tr> <ul> <xsl:copy-of select="$letter2|$letter2/preceding-sibling::li"/> </ul> <td> <xsl:copy-of select="$letter2/following-sibling::li"/> </td> </ul> </ul> </tr> </table> </xsl:template> Untested, but something along those lines... David ________________________________________________________________________ This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Complicated grouping and , Brook Ellingwood | Thread | Re: [xsl] Complicated grouping and , Will McCutchen |
[xsl] Re: generate text for every d, Kevin Rodgers | Date | Re: [xsl] generate text for every d, David Carlisle |
Month |