Subject: [xsl] Splitting merged XHTML cells From: "honyk" <honyk@xxxxxxxxx> Date: Sun, 19 Dec 2004 14:35:29 +0100 |
I need to transform xhtml table to special output. Its syntax for merging cells is similar to xhtml, but it requires to specify every cell even if it is merged: <tr> <td rowspan="2" colspan="2">A1:B2</td> <td>C1</td> </tr> <tr> <td>C2</td> </tr> <RowStart:><CellStart:2,2>A1:B1<CellEnd:><CellStart:1,1><CellEnd:><CellStart :1,1>C1<CellEnd:><RowEnd:> <RowStart:><CellStart:1,1><CellEnd:><CellStart:1,1><CellEnd:><CellStart:1,1> C2<CellEnd:><RowEnd:> For colspan I use recursion and it works fine, but for rowspan and combination with colspan I have no idea: <xsl:template match="xhtml:table"> ... <xsl:for-each select="xhtml:tr"> <xsl:text><RowStart:></xsl:text> <xsl:for-each select="./xhtml:td"> <xsl:call-template name="addTableCells"> <xsl:with-param name="numRows" select="./@rowspan" /> <xsl:with-param name="numCols" select="./@colspan" /> <xsl:with-param name="content" select="." /> </xsl:call-template> </xsl:for-each> <xsl:text><RowEnd:></xsl:text> </xsl:for-each> </xsl:template> <xsl:template name="addTableCells"> <xsl:param name="numRows" select="1" /> <xsl:param name="numCols" select="1" /> <xsl:param name="content" /> <xsl:text><CellStart:</xsl:text> <!-- rowspan --> <xsl:value-of select="$numRows" /> <xsl:text>,</xsl:text> <!-- colspan --> <xsl:value-of select="$numCols" /> <xsl:text>></xsl:text> <xsl:value-of select="$content" /> <xsl:text><CellEnd:></xsl:text> <!-- if columns are spanned --> <xsl:if test="$numCols > 1"> <xsl:call-template name="addTableCells"> <xsl:with-param name="numRows" select="1" /> <xsl:with-param name="numCols" select="$numCols - 1" /> </xsl:call-template> </xsl:if> </xsl:template> I thing similar problem was discussed here: http://www.biglist.com/lists/xsl-list/archives/200011/msg00927.html , but without proper solution.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] multiple output targets (, Michael Kay | Thread | Re: [xsl] Splitting merged XHTML ce, Marian Olteanu |
[xsl] multiple output targets (was , Bruce D'Arcus | Date | Re: [xsl] multiple output targets (, Bruce D'Arcus |
Month |