Subject: Re: [xsl] Splitting merged XHTML cells From: Marian Olteanu <mou_softwin@xxxxxxxxx> Date: Sun, 19 Dec 2004 16:18:53 -0800 (PST) |
Long time ago I solved this problem. And I cheated: I used JavaScript embeded into XSLT (using MSXML) so I reconstructed the table into a grid. --- honyk <honyk@xxxxxxxxx> wrote: > 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. > > ===== Marian http://www.utdallas.edu/~mgo031000/ __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Splitting merged XHTML cells, honyk | Thread | Re: [xsl] Splitting merged XHTML ce, Marian Olteanu |
RE: [xsl] multiple output targets (, Michael Kay | Date | Re: [xsl] multiple output targets (, Bruce D'Arcus |
Month |