[xsl] xsl multicolumn table or list layout

Subject: [xsl] xsl multicolumn table or list layout
From: "Josh Wasserman" <jwass@xxxxxxxxxxxxxxx>
Date: Tue, 27 Feb 2007 16:02:54 -0500

I have an xml file:

<?xml version="1.0" encoding="ISO-8859-1"?>
<faculty id="1">
<faculty id="5">
<faculty id="6">
<faculty id="7">
<faculty id="8">
<faculty id="9">

What I'd like to do is lay these out (with their full name which links to their bio, which is named id.xml (replace id with the id attribute for each)

Basically, each td or li item should look like this: <a href="faculty-bio.jsp?faculty={@id}"><xsl:value-of select="first_name" />&#160;<xsl:value-of select="last_name" /></a> (yes, i use a variable, this is just for simplicity's sake)

I tricked Firefox on a pc using floating divs to make this work:

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0">
<xsl:template match="members">
<xsl:variable name="emailaddress" select="email"/>
<xsl:variable name="facultyname" select="first_name+''+last_name"/>
<xsl:for-each select="faculty">
<xsl:sort select="last_name" />
<div style="float:left;position:relative;top:15px;clear:right;width:180px;height:20px;"><span style="font-size:9pt; font-weight:bold; color:#003300;"><a href="faculty-bio.jsp?faculty={@id}"><xsl:value-of select="first_name" />&#160;<xsl:value-of select="last_name" /></a></span></div>

Of course this doesn't work in IE for PC. I am aware of the tree/recursive nature of xsl, and have tried to use something like this, which I found in previous posts:

<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0">
<xsl:output method="html" indent="yes"/>
<xsl:template match="/">
<xsl:template match="members">
<xsl:variable name="t-size" select="count(faculty)"/>
<xsl:variable name="half" select="ceiling($t-size div 2)"/>
<table style="width:100%;">
<xsl:for-each select="faculty[position() &lt;= $half]">
<xsl:variable name="here" select="position()"/>
<td><a href="faculty-bio.jsp?faculty={@id}"><xsl:value-of select="."/></a></td>
<xsl:when test="../faculty[$here+$half]">
<xsl:value-of select="../faculty[$here+$half]"/>

- but it doesn't work at all.

I would be grateful for any suggestions, help, or proven methods of doing something like this.

Current Thread