This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

transposing a table


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
one?

Lee

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

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

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


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]