The user can set different options for page numbers using the following extensions: xf:skip-blank-pages, xf:initial-page-number, xf:use-sheet-number, xf:increment-by.
Example of usage:
<?xml version="1.0" encoding="utf-8" ?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xf="http://www.ecrion.com/xf/1.0"> (1)
<fo:layout-master-set>
<fo:simple-page-master master-name="FirstPage" page-width="5in" page-height="1in" margin="0.2in">
<fo:region-body region-name="PageBody"/>
<fo:region-after region-name="Footer" extent="0.2in"/>
</fo:simple-page-master>
<fo:simple-page-master master-name="LetterPage" page-width="5in" page-height="1in" margin="0.2in">
<fo:region-body region-name="PageBody"/>
<fo:region-after region-name="Footer" extent="0.2in"/>
</fo:simple-page-master>
<fo:simple-page-master master-name="BlankPage" page-width="5in" page-height="1in" margin="0.2in">
<fo:region-body region-name="PageBody"/>
<fo:region-after region-name="Footer" extent="0.2in"/>
</fo:simple-page-master>
<fo:page-sequence-master master-name="alternate">
<fo:repeatable-page-master-alternatives maximum-repeats="no-limit">
<fo:conditional-page-master-reference master-reference="FirstPage"/>
<fo:conditional-page-master-reference master-reference="BlankPage" blank-or-not-blank="blank" odd-or-even="even"/>
<fo:conditional-page-master-reference master-reference="LetterPage" odd-or-even="odd"/>
</fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="alternate" font="10pt Arial">
<fo:static-content flow-name="Footer">
<fo:block text-align="right" border-top="1pt solid black" padding-top="1mm">
Page
<fo:page-number xf:skip-blank-pages="true" (2) xf:initial-page-number="1" (3)xf:use-sheet-number="false" /> (4)
of
<fo:page-number-citation ref-id="theEnd" xf:skip-blank-pages="true"/>
</fo:block>
</fo:static-content>
<fo:flow flow-name="PageBody">
<fo:block>
The text content of the first page.
</fo:block>
<fo:block break-before="page">
The text content of the second page.
</fo:block>
<fo:block break-after="page"></fo:block>
<fo:block break-after="page"></fo:block>
<fo:block break-after="page"></fo:block>
<fo:block break-after="page"></fo:block>
<fo:block break-after="page"></fo:block>
<fo:block break-after="page"></fo:block>
<fo:block break-after="page"></fo:block>
<fo:block id="theEnd">
The text content of the last page.
</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
Key observations:
(1) In order to work with this extension, the corresponding xml namespace must be defined.
(2) xf:skip-blank-pages can also be applied to fo:page-number and fo:page-number-citation; it takes Boolean values, and if it is set to "true" the blank pages will not have page-numbers.
(3) xf:initial-page-number can be applied only to the fo:page-number element. It can take one of the following values: "auto" | "auto-odd" | "auto-even" or an integer value.
This extension sets the first page's page number. The next page's number will be the first page's, incremented by the value set by xf:increment-by (x).
xf:increment-by (x) extension's default value is "1".
(4) xf:use-sheet-numbers is used when not pages, but sheets must be numbered.
Output: