[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] [fo] conditional item in the header of a page


Subject: Re: [xsl] [fo] conditional item in the header of a page
From: Geert Bormans <geert@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 20 Apr 2009 23:10:07 +0200

Hi Ken,

Thanks for that, it works really well

Cheers
Geert



At 13:04 20/04/2009, you wrote:
At 2009-04-20 12:24 +0200, Geert Bormans wrote:
In a project I need to add a sign in the header if my page sequence spans multiple pages

Basically I have an fo:page-sequence for every occurrence of an XML element in my source
This page sequence can span multiple pages
In the header, I need to add an arrow symbol
- pointing to the right, if this particular page is not the last one in the sequence
- pointing to the left, if this particular page is not the first one in the sequence


Potentially a page has two arrow symbols in the page header
Possibly a page has no arrows (if the XML element only spans one page

This is handled very straightforwardly by using markers.


Retrieve two markers in your header, one for each of the two arrows. For the left arrow graphic use something like:

  <retrieve-marker retrieve-class-name="leftarrow"
                   retrieve-position="first-including-carryover"/>

For the right arrow graphic use something like:

  <retrieve-marker retrieve-class-name="rightarrow"
                   retrieve-position="last-ending-within-page"/>

At the start of your page sequence, have:

  <block>
    <marker marker-class-name="leftarrow"/>
    <marker marker-class-name="rightarrow">
       .... definition of right arrow ....
    </marker>
  </block>
  <block>
    <marker marker-class-name="leftarrow">
      .... definition of left arrow ....
    </marker>
  </block>
  ... rest of page sequence ...

At the end of your page sequence, have:

  ... rest of page sequence ...
  <block>
    <marker marker-class-name="rightarrow"/>
  </block>

With those definitions, the first page's left arrow is empty, but any page break after reveals the left arrow, and the start of the sequence has a definition of right arrow, but at the very end (there is always room for an empty block), the definition is blanked out. So the definition will be blank at the end of the page sequence.

The above will work on a single-page page-sequence.

I hope this helps (and I haven't mistyped!).

. . . . . . . . . Ken

--
XSLT/XSL-FO/XQuery hands-on training - Los Angeles, USA 2009-06-08
Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video
Video lesson:    http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18
Video overview:  http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18
G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
Male Cancer Awareness Nov'07  http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal


Current Thread
Keywords
xml