W3C home > Mailing lists > Public > www-xsl-fo@w3.org > March 2010

page-position="only" trait.

From: mark_anderson_us <mark.anderson@technique-group.com>
Date: Tue, 9 Mar 2010 16:55:40 -0800 (PST)
Message-ID: <27844263.post@talk.nabble.com>
To: www-xsl-fo@w3.org
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 (full
files attached)

<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  

http://old.nabble.com/file/p27844263/InvoiceLong.xml InvoiceLong.xml 
http://old.nabble.com/file/p27844263/Invoice.xsl Invoice.xsl 
-- 
View this message in context: http://old.nabble.com/page-position%3D%22only%22-trait.-tp27844263p27844263.html
Sent from the w3.org - www-xsl-fo mailing list archive at Nabble.com.
Received on Wednesday, 10 March 2010 09:20:39 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 10 March 2010 09:20:40 GMT