[Home] [By Thread] [By Date] [Recent Entries]
Abhishek,
If your stylesheet can tell ahead of time how many rows/columns a table will need, a transposition of vertical to horizontal isn't hard. Given the data you provided: At 03:39 PM 8/19/2003, you wrote: The vertical table you want will be 2 columns wide (one for the header, one for each j) and 4 rows deep (one for each i). If your table is always normalized first (thanks), this is the same as the count of MatrixHeadCell children of MatrixHeadArray in depth (rows), by the count of MatrixHeadArray + count of MatrixDataArray in width (columns). You can iterate over each of these node sets to build your vertical table. First you iterate over the rows; within that you iterate over the columns to insert the cells into each row. <xsl:template match="Matrix">
<xsl:variable name="thisMatrix" select="."/>
<table>
<xsl:for-each select="MatrixHeadArray/MatrixHeadCell">
<xsl:variable name="thisRow" select="@i"/>
<!-- we generate our rows here -->
<tr>
<!-- now we need our cells -->
<td class="head"><!-- our first cell is just our header -->
<xsl:value-of select="."/>
</td>
<!-- we need another cell for each column -->
<xsl:for-each select="$Matrix/MatrixDataArray">
<td class="body">
<xsl:value-of select="MatrixDataCell[@i=$thisRow]"/>
</td>
</xsl:for-each>
</tr>
</xsl:for-each>
</table>
</xsl:template>If your tables going in aren't regular, the problem gets much tougher, but it appears that you have good control of the data going in. Cheers, Wendell
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|

Cart



