|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Complicated grouping and column question
<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
________________________________________________________________________
|
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
|

Cart








