|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] XSL:key and Column grouping
Hello all, I have a problem with a stylesheet that groups a set of elements into three columns. As it is not flat, I have attempted to use an xsl:key function to pick out every 3rd element out of all the desired nodes. This works, but when I then use xsl:apply-templates to specify the output of those nodes and their next two siblings, the nodes returned revert to their position in the normal flow of the document. I have only recently started using xsl:key so it may be that this is a simple problem or that I don't know the proper syntax (both likely)). What I need is a way to access the key function at the apply-templates step; or conversely to specify groups of three nodes when I call the key function. I have tried both without success. Any ideas? The xsl I am using (with xalan): <xsl:key name="map" match="mapunits/maps" use="."/> <xsl:template match="chapters" mode="track-thumb"> <xsl:if test="@chap=$chapter"> <div style="margin-top: 30px; margin-bottom: 20px;"> <span class="trackNumber">Track <xsl:value-of select="$chapter"/> - </span> <span class="trackTitle"> <xsl:value-of select="chaptertitle"/> Maps</span> </div> <table border="0" cellpadding="0" cellspacing="0" > <xsl:for-each select="key('map', mapunits/maps)[position() mod 3 = 1]"> <tr valign="top" style="width:100%"> <xsl:apply-templates select=".|following-sibling::maps[position() < 3]"/> </tr> </xsl:for-each> </table> </xsl:if> </xsl:template> Cheers, dave David Laurie MA Humanities Computing
|
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
|






