transposing a table

Subject: transposing a table
From: "Pollington, Lee (ELSLON)" <lee.pollington@xxxxxxxxxxxxx>
Date: Thu, 23 Nov 2000 13:07:57 -0000
Hi, we've been think about the best way to transpose a table (turn it by
90degs). It has an equal number of columns per row. I've come up with the
solution below. Does anyone have a better one or ideas for improving this


<xsl:template match="/">
    <xsl:apply-templates select="/root/row[1]/col" mode="row"/>

<xsl:template match="col" mode="row">
    <xsl:variable name="pos" select="position()"/>
    <xsl:apply-templates select="/root/row/col[$pos]" mode="col"/>

<xsl:template match="col" mode="col">
  <col><xsl:value-of select="."/></col>

 XSL-List info and archive:

Current Thread