Re: [xsl] need a hint on matching table cells

Subject: Re: [xsl] need a hint on matching table cells
From: "J.Pietschmann" <j3322ptm@xxxxxxxx>
Date: Thu, 18 Jul 2002 01:02:22 +0200
Brad Miller wrote:
<xsl:template match="T-BODY/ROW">
 <tr>
   <xsl:if test="CELL/@SPAN = 'grey'">
     <td colspan="2" class="grey"><xsl:apply-templates  select = "CELL" /></td>

First: the test is true if there is *at least one* CELL with a @SPAN='grey' in the row. Furthermore you are matching *all* CELL elements here. Therefore you get one <td> with the content of all CELL elements in it. The next xsl:if matches too, and you get another td etc.

Probably you want
 <xsl:template match="T-BODY/ROW">
   <tr>
     <xsl:apply-templates/>
   </tr>
 </xsl:template>

 <xsl:template match="CELL[@SPAN = 'grey']">
   <td colspan="2" class="grey">
      <xsl:apply-templates/>
   </td>
 </xsl:template>

 <xsl:template match="CELL[@SPAN = 'lightgrey']">
   <td colspan="2" class="lightgrey">
     <xsl:apply-templates/>
   </td>
 </xsl:template>

etc.

J.Pietschmann


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread