Subject: Re: [xsl] displaying a list in a multi-column table From: John Snelson <john.snelson@xxxxxxxxxx> Date: Fri, 25 Jan 2008 14:11:10 +0000 |
<table> <xsl:for-each-group select="word" group-by="position() mod 4"> <tr> <xsl:for-each select="current-group()"> <td><xsl:value-of select="."/></td> </xsl:for-each> </tr> </xsl:for-each-group> </table>
I have a list of words, possibly 3500 to 7000 in length, in alphabetical order. I need to display them in an HTML page in a table of four columns. The first quarter of the words should be in the first column, the second quarter in the second column, etc. Since the total may not be divisible by four, the final column may be incomplete. Let's say the input is of the form: <wordList> <word>aaron</word> <word>abated</word> <word>abatement</word> .. </wordList>
How can I do this with an XSLT transform?
I can use XSLT 2.0
I have done similar things in the past, but looking back, they aren't graceful and I don't think they take advantage of the current capabilities of the language.
-- John Snelson, Oracle Corporation http://snelson.org.uk/john Berkeley DB XML: http://www.oracle.com/database/berkeley-db/xml XQilla: http://xqilla.sourceforge.net
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] displaying a list in a mu, Andrew Welch | Thread | Re: [xsl] displaying a list in a mu, Andrew Welch |
Re: [xsl] displaying a list in a mu, Andrew Welch | Date | Re: [xsl] displaying a list in a mu, Andrew Welch |
Month |