RE: [xsl] problem with table

Subject: RE: [xsl] problem with table
From: Eldho George <georgee@xxxxxxxxxxx>
Date: Mon, 20 Sep 2004 16:29:03 +0530
Thanks ken.Thank you very much for your nice reply
It tried your code snippet and it worked fine

-----Original Message-----
From: G. Ken Holman [mailto:gkholman@xxxxxxxxxxxxxxxxxxxx] 
Sent: Monday, September 20, 2004 4:14 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] problem with table

At 2004-09-20 15:21 +0530, Eldho George wrote:
>I have some problem with <fo:table-column>.Suppose i am using different
>table structure such as
>first <tr> contains 3 <td>.Second <tr> contains 4 <td>.Then 3<tr> onwards
>contains 6 <td>
>The following is my table template.
><xsl:for-each select="tr/th|tr/td|thead/tr/th|thead/tr/td">
>         <fo:table-column/>

This would obtain *every* th and *every* td and give you one table column 
per item, which is why you are getting so many columns.

Remember that all rows in an XSL-FO table will render with the same number 
of columns and the column edges will be the same for all rows in a single 

Thus, you need only traverse the maximum number of columns.  The maximum 
number of columns can be obtained by sorting the rows by the number of 
columns, sorting them in descending order, and acting on the first of those:

       <xsl:for-each select="tr|thead/tr">
         <xsl:sort select="count(td|th)" data-type="number"
         <xsl:if test="position()=1">
           <xsl:for-each select="td|th">

I hope this helps.

............................ Ken

World-wide on-site corporate, govt. & user group XML/XSL training.
G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.
Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
Male Breast Cancer Awareness
Legal business disclaimers:

This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

Current Thread