Question

I would like to create an AFP parsing an XML. therefor I do use two tables. (i need those tables, its a billing)

It all works well, but i cant figure out how to implement following requirement:

  • "keep-together" the second table. only show the header of the second table, if its on a separate page (not on the same page with table one).

so if the second table can be placed within the same page as the first table, i want to fade out the header. if the second table gets on the next page because of the "keep together", I want to show the header

so i do have a second table which "keeps-together" like this:

<fo:table table-layout="fixed" width="180mm" keep-together.within-page="always">

I'm looking for a way now, to figure out how to change this header at given circumstances. Is that even possible with XSL-FO? (i imagine something like this:)

<xsl:if test="$keep-together.within-page !=''">
  <fo:table-header>
  ...
  </fo:table-header>
</xsl:if>

but ofc this is not working. does anybody having an idea?

sorry for my bad english. any help is very appreciated!

cheers

Was it helpful?

Solution

if the second table can be placed within the same page as the first table, i want to fade out the header. if the second table gets on the next page because of the "keep together", I want to show the header

There are a few options for modifying the headers of a single table that spans page breaks. See table-omit-header-at-break and rx:table-omit-initial-header (the latter is a XEP extension).

But what you are asking for is not possible. The display of a table header cannot depend on whether the table falls on the same output page as another table.


Creating AFP (or PDF) output from XSL-FO is a process with two independent stages:

  1. The required FO markup is generated (applying an XSLT stylesheet to an XML source document is the most common way to do this).
  2. The generated markup is processed by a FO engine that lays out the content on one or more output pages.

You imagine something like this:

<xsl:if test="$keep-together.within-page !=''">
   ...
</xsl:if>

This is impossible. It is an attempt to blur the line between the two stages. In stage 1, nothing is known about the actual pages that are produced in stage 2.

In XSL-FO, you can specify rules for various contingencies (conditions on properties such as keep-with-next, keep-together, orphans, widows, etc). But there is no way to test if table B is on the same page as table A or if a property has "taken effect". It just does not work that way.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top