1
votes

I have added to my xml elements that they are forced to be rendered on either an even or an odd page. This I have done with the attribute break-before="odd-page" or also break-before="even-page". So far everything works great!

My problem is that it can happen that an empty page is created, for example when an element is already on an even page and is then forced to start on an even page. The created empty page (only the body is empty) still has the same static-content as the page before.

But I want a completely empty page to be inserted in such a case without page number, header or similar.

Is this somehow possible?

I am using Apache-Formatting-Objects-Processor 2.3 (fop 2.3)

1

1 Answers

2
votes

You want an fo:conditional-page-master-reference (see https://www.w3.org/TR/xsl11/#fo_conditional-page-master-reference) with a blank-or-not-blank (see https://www.w3.org/TR/xsl11/#blank-or-not-blank) value of blank.

The first fo:conditional-page-master-reference for which all of its traits are true is the one that is selected, so the new fo:conditional-page-master-reference should come before your fo:conditional-page-master-reference that refer to the page masters for odd and even pages. Here's an example that comes from a FOP test file (I think):

<fo:page-sequence-master master-name="pages">
  <fo:repeatable-page-master-alternatives>
    <fo:conditional-page-master-reference page-position="first" master-reference="first-page"/>
    <fo:conditional-page-master-reference page-position="last" master-reference="last-page"/>
    <fo:conditional-page-master-reference blank-or-not-blank="blank" 
      master-reference="blank-page"/>
    <fo:conditional-page-master-reference odd-or-even="odd" master-reference="odd-page"/>
    <fo:conditional-page-master-reference odd-or-even="even" master-reference="even-page"/>
  </fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>

For completely blank pages, the second part of the solution is not direct your existing fo:static-content to any regions on the blank pages. The fo:simple-page-master for blank pages should either not contain fo:region-after, etc., or, if it did include them, those regions should have different region-name values to the flow-name values in your existing fo:static-content.