Jean-Francois Selber wrote:

> In fact I can't used different page-master and  the region-before to replace
> the table-header
> because I can have successivly two table in the same page sequence and
> for this two table I want to display header only on the second page. In fact
> header would be only display if the table in too big
> for the current page, then only if the table is write on different page
>
> Thanks

This sounds like the problem I just had. My application is an html-to-pdf 
converter. If the first table row contains only table headers then I want to 
propagate it by way of an fo:table-header. This also implies suppressing that 
row from the table body, as well as counting columns in the first row. Here are 
my templates:

  <xsl:template match="table">
    <fo:table table-layout="fixed" width="100%">
    <!-- First row sets column count and possible table header -->
    <xsl:apply-templates select="descendant::tr[1]" mode="columns"/>
    <fo:table-body>
    <xsl:apply-templates select="descendant::tr[position()!=1]" mode="row"/>
    </fo:table-body>
    </fo:table>
  </xsl:template>

  <!-- Set columns by width or column span, default to even width -->
  <xsl:template match="tr" mode="columns">
    <xsl:for-each select="th|td">
      <xsl:choose>
      <xsl:when test="count(@width)!=0">
        <fo:table-column>
        <xsl:attribute name="column-width">
          <xsl:text>proportional-column-width(</xsl:text>
          <xsl:value-of select="substring-before(@width[1], '%')"/>
          <xsl:text>)</xsl:text>
        </xsl:attribute>
        </fo:table-column>
      </xsl:when>
      <xsl:when test="count(@colspan)!=0">
        <xsl:call-template name="colspan">
          <xsl:with-param name="count" select="number(@colspan)"/>
        </xsl:call-template>
      </xsl:when>
      <xsl:otherwise>
        <fo:table-column column-width="proportional-column-width(1)"/>
      </xsl:otherwise>
      </xsl:choose>
    </xsl:for-each>
    <xsl:choose>
    <!-- Propagate an all-th row as a table header -->
    <xsl:when test="count(th)!=0 and count(td)=0">
      <fo:table-header>
      <fo:table-row>
      <xsl:apply-templates/>
      </fo:table-row>
      </fo:table-header>
    </xsl:when>
    <!-- If not all-th, then treat as a normal row -->
    <xsl:otherwise>
      <xsl:apply-templates select="." mode="row"/>
    </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template name="colspan">
    <xsl:param name="count"/>
    <xsl:if test="number($count)&gt;0">
      <fo:table-column column-width="proportional-column-width(1)"/>
      <xsl:call-template name="colspan">
        <xsl:with-param name="count" select="number($count)-1"/>
      </xsl:call-template>
    </xsl:if>
  </xsl:template>

  <xsl:template match="tr" mode="row">
    <fo:table-row keep-together="always">
    <xsl:apply-templates/>
    </fo:table-row>
  </xsl:template>

I hope this is helpful.

John Marshall
Accurate Software

The Courtyard, Denmark Street, Wokingham, Berkshire, RG40 2AZ, UK.
Tel: +44 (0)118 977 3889
Fax: +44 (0)118 977 1260
http://www.accuratesoftware.com <http://www.accuratesoftware.com>




-----Original Message-----
From: Selber Jean-François [mailto:[EMAIL PROTECTED]
Sent: 15 May 2003 17:09
To: [EMAIL PROTECTED]
Subject: Re: help about fo:table-header





----- Original Message -----
From: "Clay Leeds" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, May 15, 2003 5:24 PM
Subject: Re: help about fo:table-header


> The idea is to use a different page-master on the second and subsequent
> page. Then, you can put your "table-header" block in the region-before.
>
> On 5/15/2003 8:07 AM, Selber Jean-François wrote:
> > I want to find a way to not display table-header in first time and only
> > display header on the start
> > of next page if the table is too big to be display on the same page
>
> --
> Clay Leeds - [EMAIL PROTECTED]
> Web Developer - Medata, Inc. - http://www.medata.com
> PGP Public Key: https://mail.medata.com/pgp/cleeds.asc
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



The UK office of Accurate Software will be moving offices from May 19th to the 
following new location:
80 Peach Street, Wokingham, Berkshire, RG40 1XH.
The existing telephone and fax numbers will remain unchanged.

Accurate Software

[EMAIL PROTECTED]
www.accuratesoftware.com

Europe . North America . Australasia . Africa

The information in this email is confidential and privileged and is intended 
only for the use of the individual or entity listed above.  If you are neither 
the intended individual, or entity listed above, nor the person responsible for 
the delivery of this email to the intended recipients, you are hereby notified 
that any unauthorised distribution, copying or use of this email is prohibited. 
If you have received this email in error, please notify the Accurate system 
manager at [EMAIL PROTECTED] or on +44 (0)118 977 3889.  The views expressed in 
this communication may not necessarily be the views held by the Accurate Group.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to