Subject:XSLT to sort a list alphabetically and divide it into two columns... Author:ena jenkins Date:11 Mar 2009 06:39 PM Originally Posted: 11 Mar 2009 06:40 PM
Hi,
I need to sort a list of countries alphabetically and display the list
in two columns, but I need the alphabetical list to read vertically
instead of left to right. How do I do this?
Type of output needed (Example):
Australia Finland
Belgium Hong Kong
Canada India
Chile Switzerland
Subject:XSLT to sort a list alphabetically and divide it into two columns... Author:John Bampton Date:12 Mar 2009 10:31 AM Originally Posted: 12 Mar 2009 10:29 AM
Subject:XSLT to sort a list alphabetically and divide it into two columns... Author:James Durning Date:12 Mar 2009 03:12 PM Originally Posted: 12 Mar 2009 02:21 PM
Replace the 4's with $counthalf, and change variable declaration to:
<xsl:variable name="counthalf" select="ceiling(count(countries/country) div 2)"/>
to deal with odd numbers.
There's no need to create an extra variable to hold the sorted countries; the position() function automatically updates when using the for-each and sort elements.
With these modifications, you would only need XSLT 1.0.