Re: (dsssl) XSLT - HTML - Table - Columns

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:template match="College">
    <table border="1">
        <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 -->
           select="Pupil/Cource[not(@nam = preceding::Cource/@nam)]">
        <!-- Optional: uncomment this to sort the Cources -->
        <!-- <xsl:sort select="@nam"/> -->

  <xsl:template match="Pupil">
    <td><xsl:value-of select="@val"/></td>

  <xsl:template match="Cource">
    <xsl:variable name="nam" select="@nam"/>
      <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,' '))"/> -->
          <xsl:variable name="cval" select="Cource[@nam = $nam]/@val"/>
            <xsl:when test="$cval"><xsl:value-of select="$cval"/></xsl:when>

-Brandon :)

 DSSSList info and archive:

Current Thread