xsl-list
[Top] [All Lists]

Re: how i can use 'table' in fo in differt way ?

2004-04-16 08:48:35
At 2004-04-16 16:46 +0100, Roberta Granata wrote:
The problem is that when a use a 'table' in the xsl
file , it forces me to indicate how many columns i
need to use and the width.

Yes, this is true for tables.

In my script i have two columns.
I want that :
when the text of the second column is empty ,
the text of the first column takes all the line of the
document

Unfortunately I did not get your example cleanly, but you should be able to add something along the lines of:

  <table-cell>
    <xsl:if test="not(string(second-column))"
      <xsl:attribute name="number-columns-spanned">2</xsl:attribute>
    </xsl:if>
    <block>
      ...column contents...
  </table-cell>
  <xsl:if test="string(second-column)">
    <table-cell>
      <block>
        ...column contents...
    </table-cell>
  </xsl:if>

With the above technique you are conditionally adding the number-columns-spanned="2" attribute to the first table cell if the second table cell is empty. Be sure, though, to test for the creation of the second table cell or you will end up specifying three columns.

I hope this helps.

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

--
Public courses: Spring 2004 world tour of hands-on XSL instruction
Each week:   Monday-Wednesday: XSLT/XPath; Thursday-Friday: XSL-FO
Hong Kong May 17-21; Bremen Germany May 24-28; Helsinki June 14-18

World-wide on-site corporate, govt. & user group XML/XSL training.
G. Ken Holman                 mailto:gkholman(_at_)CraneSoftwrights(_dot_)com
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
Male Breast Cancer Awareness  http://www.CraneSoftwrights.com/s/bc