[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: displaying a list in a multi-column table

Subject: Re: displaying a list in a multi-column table
From: "Andrew Welch" <andrew.j.welch@xxxxxxxxx>
Date: Fri, 25 Jan 2008 14:04:38 +0000
Re:  displaying a list in a multi-column table
On 25/01/2008, Michael Tracey Zellmann <tracey.zellmann@xxxxxxxxx> wrote:
> 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

That's good... in which case you can do:

    <xsl:for-each-group select="$wordlist"
group-starting-with="*[position() mod 4 = 1]">
  	  <tr>
  	    <xsl:for-each select="current-group()">
  	      <td><xsl:value-of select="."/></td>	
  	    </xsl:for-each>
  	  </tr>    	
    </xsl:for-each-group>


cheers
-- 
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Cast Your Vote

We need your help – Vote for DataDirect XML Products!

  • Best SOA or XML site

Winners and finalists announced at SOA World Conference in November.

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.