Subject: Re: (dsssl) XSLT - HTML - Table - Columns From: Brandon Ibach <bibach@xxxxxxxxxxxxxx> Date: Sun, 6 Oct 2002 10:01:42 -0500 |
Quoting Raghavendra_Gowdu@xxxxxxxxxxxxxxx <Raghavendra_Gowdu@xxxxxxxxxxxxxxx>: > XSLTers, I tried couple of options. Not successful. May be simple!. Any > clue is appreciated. > I want to create a multi header html table from an XML. > A few administrative details omitted, and completely untested (let me know if you have problems with it): <xsl:stylesheet> <xsl:template match="College"> <html> <body> <table border="1"> <tr> <td> </td> <xsl:apply-templates select="Pupil"> <!-- Optional: uncomment this to sort the Pupils --> <!-- <xsl:sort select="concat(substring-after(@val,' '),' ',substring-before(@val,' '))"/> --> <!-- Editorial: you could do better here if the first and last names were separate attributes --> </xsl:apply-templates> </tr> <xsl:apply-templates select="Pupil/Cource[not(@nam = preceding::Cource/@nam)]"> <!-- Optional: uncomment this to sort the Cources --> <!-- <xsl:sort select="@nam"/> --> </xsl:apply-templates> </table> </body> </html> </xsl:template> <xsl:template match="Pupil"> <td><xsl:value-of select="@val"/></td> </xsl:template> <xsl:template match="Cource"> <xsl:variable name="nam" select="@nam"/> <tr> <td><xsl:value-of select="@nam"/></td> <xsl:for-each select="ancestor::College/Pupil"> <!-- This must match the Pupil sort (or no sort) above --> <!-- <xsl:sort select="concat(substring-after(@val,' '),' ',substring-before(@val,' '))"/> --> <td> <xsl:variable name="cval" select="Cource[@nam = $nam]/@val"/> <xsl:choose> <xsl:when test="$cval"><xsl:value-of select="$cval"/></xsl:when> <xsl:otherwise> </xsl:otherwise> </xsl:choose> </td> </xsl:for-each> </tr> </xsl:template> </xsl:stylesheet> -Brandon :) DSSSList info and archive: http://www.mulberrytech.com/dsssl/dssslist
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: (dsssl) XSLT - HTML - Table - C, Bita Akhlaghi | Thread | |
RE: (dsssl) XSLT - HTML - Table - C, Bita Akhlaghi | Date | |
Month |