[xsl] Problems with page-position="only" and FOP 0.95

Subject: [xsl] Problems with page-position="only" and FOP 0.95
From: Mark Anderson <mark.anderson@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 10 Mar 2010 00:49:23 +0000
Hi All

I'm in the process of testing various FO Processors. I created some test
files, one of which was a single page invoice and a multi-page invoice. The
first page has a full header and remaining pages have a small headers (logo
only). The last page has a big footer with totals. If the invoice only has a
few lines then the big footer needs to go on page 1 (so first page header and
last page footer). To accomplish this I use a conditional page-master with the
page-position="only" trait.

It works fine for multi-page invoices in Antenna House and XEP, but in FOP, I
get the "only" layout for every page. This was supposed to be fixed in FOP
0.92, but still doesn't seem to work. Below is a snippet from my XSL:

<xsl:template match="/tg_invoice">
    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format";>

      <fo:layout-master-set>
        <!-- Define all page masters here -->
        <fo:page-sequence-master master-name="contents_sequence">
          <!-- Define sequence. First page will be "cover", next page will be
"continuation" -->
          <fo:repeatable-page-master-alternatives>
            <!-- List of page masters that will be selected according the
result of the page-position trait -->
            <fo:conditional-page-master-reference page-position="only"
master-reference="single"/>
            <fo:conditional-page-master-reference page-position="first"
master-reference="cover"/>
            <fo:conditional-page-master-reference page-position="rest"
master-reference="continuation"/>
            <fo:conditional-page-master-reference page-position="last"
master-reference="last"/>
          </fo:repeatable-page-master-alternatives>
        </fo:page-sequence-master>

        <!-- Layout for single page invoices -->
        <fo:simple-page-master master-name="single" page-height="29.7cm"
page-width="21cm" margin-top="1cm" margin-bottom="1cm" margin-left="1cm"
margin-right="1cm">
          <fo:region-body margin-top="9cm" margin-bottom="3cm"/>
          <fo:region-before region-name="header_first" extent="9cm"/>
          <fo:region-after region-name="footer_last" extent="3cm"/>
        </fo:simple-page-master>
        <!-- End -->

        <!-- Layout for first page -->
        <fo:simple-page-master master-name="cover" page-height="29.7cm"
page-width="21cm" margin-top="1cm" margin-bottom="1cm" margin-left="1cm"
margin-right="1cm">
          <fo:region-body margin-top="9cm" margin-bottom="1cm"/>
          <fo:region-before region-name="header_first" extent="9cm"/>
          <fo:region-after region-name="footer_rest" extent="1cm"/>
        </fo:simple-page-master>
        <!-- End -->

        <!-- Layout for subsequent pages -->
        <fo:simple-page-master master-name="continuation" page-height="29.7cm"
page-width="21cm" margin-top="1cm" margin-bottom="1cm" margin-left="1cm"
margin-right="1cm">
          <fo:region-body margin-top="3cm" margin-bottom="1cm"/>
          <fo:region-before region-name="header_rest" extent="3cm"/>
          <fo:region-after region-name="footer_rest" extent="1cm"/>
        </fo:simple-page-master>
        <!-- End -->

        <!-- Layout for last page -->
        <fo:simple-page-master master-name="last" page-height="29.7cm"
page-width="21cm" margin-top="1cm" margin-bottom="1cm" margin-left="1cm"
margin-right="1cm">
          <fo:region-body margin-top="3cm" margin-bottom="3cm"/>
          <fo:region-before region-name="header_rest" extent="2cm"/>
          <fo:region-after region-name="footer_last" extent="3cm"/>
        </fo:simple-page-master>
        <!-- End -->
      </fo:layout-master-set>
      <!-- End page masters -->

Does the above look correct?

M a r k 

Current Thread