W3C home > Mailing lists > Public > www-xsl-fo@w3.org > November 2002

Variable number of table columns

From: Eklund Anders <anders.eklund@celsiusmetech.se>
Date: Thu, 14 Nov 2002 04:51:30 -0500 (EST)
Message-ID: <AFE181932DAB3149A0F6568A3FE93D00514CEA@m02s051.m02.se>
To: <www-xsl-fo@w3.org>




Variable number of table columns?

I have an .xml-file with tables. The problem is that I don't know the number of columns in each table.
Then I don't know how many <fo:table-column> I need to have a proportional table where all tables have the same width.
Anyone who can help?

========== Example .xml ===========
<table id="1">
  <row>
    <column>11</column>
    <column>12</column>
    <column>13</column>
  </row>
  <row>
    <column>21</column>
    <column>22</column>
    <column>23</column>
  </row>
</table>
<table id="2">
  <row>
    <column>11</column>
    <column>12</column>
  </row>
  <row>
    <column>21</column>
    <column>22</column>
  </row>
</table>

========== Example .xsl ===========
<xsl:for-each select="table">
  <fo:table>
     
     <!-- I don't know the number of columns in the .xml-file.
           How to design a "dynamic table"?  -->     
     
     <fo:table-column column-width="50pt"/>
     <fo:table-column column-width="50pt"/>


       <fo:table-body>
         <xsl:for-each select="row">
           <fo:table-row>
             <xsl:for-each select="column">
               <fo:table-cell>
                 <fo:block"><xsl:value-of select="."/></fo:block>
               </fo:table-cell>
             </xsl:for-each>
           </fo:table-row>                 
         </xsl:for-each>
      </fo:table-body>
   </fo:table>
</xsl:for-each>

Best Regards
Anders Eklund
Received on Thursday, 14 November 2002 07:50:47 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 3 October 2007 16:06:10 GMT