RE: [xsl] Having same number of rows in table irrespective of number of data rows

Subject: RE: [xsl] Having same number of rows in table irrespective of number of data rows
From: "Bondarenko, Taras" <TBondarenko@xxxxxxxx>
Date: Tue, 12 Apr 2005 10:37:18 -0400
Actually there is an evil solution posted many times in this list and
several sites like topxml.com

<xsl:template match="TAG">
 <TABLE>

  <xsl:for-each select="(document('')//*)[position() &lt;=
$Number-Of-Rows]">
   <TR ID="@ID">
    <TD> </TD>
   </TR>
  </xsl:for-each>

 </TABLE>
</xsl:template>


-----Original Message-----
From: Steve W [mailto:lsl@xxxxxxxxxxxxx]
Sent: Tuesday, April 12, 2005 2:58 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: [xsl] Having same number of rows in table irrespective of
number of data rows

I want to create a table that has a set number of rows in it.  The XML
has
data in it to be shown in the table - in simple terms one element of the
XML
for each row of the table.  The XML will only have an element if there
is
data,  so if I have 3 data elements but I want 5 rows in the table there
will be 2 'missing' rows and I want to output these 2 rows with some set
html in it.

My template looks like this :

<table cellpadding="0" cellspacing="0" border="0" width="100%">
    <xsl:for-each select="INITIALVALUES/INITIALVALUE">
        <tr>
            <td>
                <!-- some html ....  -->
                </td>
            </tr>
    </xsl:for-each>
    <!-- add 'blank' rows to give constant number of rows in table -->
</table>

Thanks

Steve

Current Thread