trying to insert a blank page in XSL-FO

2.5k views Asked by At

I'm trying to insert a blank page as the last page of some chapters. For instance, I want a blank page after the cover page. I'm doing it like this:

    <fo:page-sequence-master master-name="cover_pagemaster" force-page-count="even">
       <fo:repeatable-page-master-alternatives>
          <fo:conditional-page-master-reference master-reference="cover" page-position="any" />
           <fo:conditional-page-master-reference master-reference="empty_page" page-position="last" blank-or-not-blank="blank" />
       </fo:repeatable-page-master-alternatives>
    </fo:page-sequence-master>

It should be two pages, one with the cover and one blank. Why doesnt it work that way?

Thanx for help!

EDIT:

        <fo:page-sequence-master master-name="cover_pagemaster" force-page-count="even">
           <fo:repeatable-page-master-alternatives>
                <fo:conditional-page-master-reference master-reference="empty_page" page-position="last" blank-or-not-blank="blank" />
                <fo:conditional-page-master-reference master-reference="cover" page-position="first" />
           </fo:repeatable-page-master-alternatives>
        </fo:page-sequence-master>

Well, I tried different combinations now and it still doesnt work. Not even the force-page-count works (I'm using the evaluation version of Antenna House).

I just cant find a working example of xsl-fo code that produces a blank page as the second page of a two-page page-master.

2nd EDIT:

    <fo:simple-page-master master-name="cover" page-height="29.7cm" page-width="21cm">
       <fo:region-body />
    </fo:simple-page-master>

    <fo:simple-page-master master-name="empty_page">
       <fo:region-body />
    </fo:simple-page-master>

and then in the page-sequence:

 <fo:page-sequence master-reference="cover_pagemaster">
    <fo:flow flow-name="xsl-region-body">
       <fo:block-container absolute-position="absolute" top="70mm" left="30mm">
          <fo:block>
             <fo:external-graphic src="coverpage.png" content-width="140mm" content-height="90mm" />
          </fo:block>
       </fo:block-container>
       <fo:block-container text-align="right" hyphenate="true" absolute-position="absolute" font-family="Calibri" font-size="4em" top="200mm" left="42mm" margin-right="10mm">
          <fo:block>COVERPAGE</fo:block>
          <fo:block>TEST</fo:block>
          <fo:block>ABSOLUTE POSITIONING
          </fo:block>
       </fo:block-container>
    </fo:flow>
 </fo:page-sequence
1

There are 1 answers

2
Hobbes On BEST ANSWER

The list of repeatable-page-master-alternatives is processed in order. So when the formatter processes the last page of a chapter, it will go through the list, and it will see that the condition for the first entry (page-position="any") is valid for this page. so the last page gets assigned "cover" without checking the full list of alternatives.
So you should build the list of repeatable-page-master-alternatives to have the exceptions (first page, last page) listed before the more common pages (left, right, any).

Edit:

Now they're in the correct order. But you've specified blank-or-not-blank="blank". This means "only use this master page if the page is blank (i.e. contains no body text)".
What does the second page currently look like? Which master page gets used?

Edit 2:
In the force-page-count attribute you must use "end-on-even" instead of "even".