[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: XML->HTML tables with blank cells ...
I thought you might be needing a generic solution (when number of columns are variable). Here is a solution for this: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" indent="yes" /> <xsl:template match="/worksheet"> <html> <head> <title/> </head> <body> <table> <tr> <xsl:for-each select="row[@number = '0']/col"> <th><xsl:value-of select="." /></th> </xsl:for-each> </tr> <xsl:variable name="n" select="count(row[@number = '0']/col) - 1" /> <xsl:for-each select="row[not(@number = '0')]"> <tr> <xsl:call-template name="GenerateRows"> <xsl:with-param name="m" select="$n" /> <xsl:with-param name="n" select="$n" /> <xsl:with-param name="row" select="." /> </xsl:call-template> </tr> </xsl:for-each> </table> </body> </html> </xsl:template> <xsl:template name="GenerateRows"> <xsl:param name="m" /> <xsl:param name="n" /> <xsl:param name="row" /> <xsl:if test="$m >= 0"> <td><xsl:value-of select="$row/col[@number = ($n - $m)]" /></td> <xsl:call-template name="GenerateRows"> <xsl:with-param name="m" select="$m - 1" /> <xsl:with-param name="n" select="$n" /> <xsl:with-param name="row" select="$row" /> </xsl:call-template> </xsl:if> </xsl:template> </xsl:stylesheet> Regards, Mukul On 7/11/06, Carmen Pancerella <carmen@xxxxxxxxxxxxx> wrote: Hello.
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|