[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Splitting merged XHTML cells

Subject: Re: Splitting merged XHTML cells
From: Marian Olteanu <mou_softwin@xxxxxxxxx>
Date: Sun, 19 Dec 2004 16:18:53 -0800 (PST)
splitting of cells
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>&lt;RowStart:&gt;</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>&lt;RowEnd:&gt;</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>&lt;CellStart:</xsl:text>
>   <!-- rowspan -->
>   <xsl:value-of select="$numRows" />
>   <xsl:text>,</xsl:text>
>   <!-- colspan -->
>   <xsl:value-of select="$numCols" />
>   <xsl:text>&gt;</xsl:text>
>   <xsl:value-of select="$content" />
>   <xsl:text>&lt;CellEnd:&gt;</xsl:text>
>   <!-- if columns are spanned -->
>   <xsl:if test="$numCols &gt; 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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.