XML technologies / XSL-FO / Reference / Attributes in XSL-FO / page-position

(Excerpt from "XSL-FO ― Die Referenz" by Manuel Montero Pineda & Steffen Herkert, 2016, dpunkt.verlag)

A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z

Recommendation section: 7.27.14

Category: 7.27 Pagination and Layout Properties

Description

The <fo:conditional-page-master-reference> elements describe a page sequence within <fo:repeatable-page-master-alternatives>. A <fo:conditional-page-master-reference> refers to a page master. The page-position attribute specifies where in the generated document that master may be used: the first page, the last page, the remaining pages, or all pages. Combined with odd-or-even, several masters with the same page-position value can occur in <fo:repeatable-page-master-alternatives>.

Values

first

The page master may be used only for the first page.

last

The page master may be used only for the last page.

rest

The page master is used for all pages except the first and last.

any

The page master can be used for any page without another applicable master.

only

The page master must be only one page long, making that page both the first and the last. In this case, the value only can be used.

Inherited:

yes

Default value: any

XSL-FO version: 1.0

Allowed in:

<fo:conditional-page-master-reference>

This element names a page master object to be used when the required conditions are met.

Support:

Conformance level

Antenna House

FOP

RenderX XEP

Altsoft XML2PDF

Compart DocBridge

Extended

Y

Y

Y

P

Y

XSL-FO example:

<fo:root font-family="Arial" font-size="10pt" line-height="1.2em" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:cpfo="http://www.compart.net/xmlns/cpfo" xmlns:svg="http://www.w3.org/2000/svg" xmlns:axf="http://www.antennahouse.com/names/XSL/Extensions">
<fo:layout-master-set>
<fo:simple-page-master master-name="Inhalt-Seiten.first" margin="0mm 0mm 0mm
                      0mm" page-height="auto" page-width="auto">
<fo:region-body margin="20mm 15mm 5mm
                        25mm"/>
<fo:region-before extent="5mm" region-name="first.before"/>
</fo:simple-page-master>
<fo:simple-page-master master-name="Inhalt-Seiten.rest" margin="0mm 0mm 0mm
                      0mm" page-height="auto" page-width="auto">
<fo:region-body margin="20mm 15mm 5mm
                        25mm"/>
<fo:region-before extent="5mm" region-name="rest.before"/>
</fo:simple-page-master>
<fo:simple-page-master master-name="Inhalt-Seiten.last" margin="0mm 0mm 0mm
                      0mm" page-height="auto" page-width="auto">
<fo:region-body margin="20mm 15mm 5mm
                        25mm"/>
<fo:region-before extent="5mm" region-name="last.before"/>
</fo:simple-page-master>
<fo:simple-page-master master-name="Inhalt-Seiten.any" margin="0mm 0mm 0mm
                      0mm" page-height="auto" page-width="auto">
<fo:region-body margin="20mm 15mm 5mm
                        25mm"/>
<fo:region-before extent="5mm" region-name="any.before"/>
</fo:simple-page-master>
<fo:page-sequence-master master-name="Inhalt-Seiten.master">
<fo:repeatable-page-master-alternatives>
<fo:conditional-page-master-reference master-reference="Inhalt-Seiten.rest" page-position="rest"/>
<fo:conditional-page-master-reference master-reference="Inhalt-Seiten.first" page-position="first"/>
<fo:conditional-page-master-reference master-reference="Inhalt-Seiten.last" page-position="last"/>
</fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>
<fo:page-sequence-master master-name="Inhalt-Seiten.master2">
<fo:repeatable-page-master-alternatives>
<fo:conditional-page-master-reference master-reference="Inhalt-Seiten.rest" page-position="rest"/>
<fo:conditional-page-master-reference master-reference="Inhalt-Seiten.any" page-position="any"/>
</fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="Inhalt-Seiten.master" font-size="10pt">
<fo:static-content flow-name="first.before">
<fo:block margin-top="2mm" text-align="center" font-size="16pt">
 Seitenvorlage
              
<fo:inline font-weight="700">
erste Seite
</fo:inline>
;
                page-position="
<fo:inline font-weight="700">
first
</fo:inline>
" 
</fo:block>
</fo:static-content>
<fo:static-content flow-name="rest.before">
<fo:block margin-top="2mm" text-align="center" font-size="16pt">
 Seitenvorlage: 
<fo:inline font-weight="700">
übrige Seiten
</fo:inline>
; page-position="
<fo:inline font-weight="700">
rest
</fo:inline>
" 
</fo:block>
</fo:static-content>
<fo:static-content flow-name="last.before">
<fo:block margin-top="2mm" text-align="center" font-size="16pt">
 Seitenvorlage:
              
<fo:inline font-weight="700">
letzte Seite
</fo:inline>
;
                page-position="
<fo:inline font-weight="700">
last
</fo:inline>
" 
</fo:block>
</fo:static-content>
<fo:flow flow-name="xsl-region-body">
<fo:block page-break-after="always">
Inhalt 1. Seitenfolge
</fo:block>
<fo:block page-break-after="always">
Inhalt 1.
                Seitenfolge
</fo:block>
<fo:block page-break-after="always">
Inhalt 1. Seitenfolge
</fo:block>
<fo:block page-break-after="always">
Inhalt 1.
                Seitenfolge
</fo:block>
<fo:block page-break-after="always">
Inhalt 1. Seitenfolge
</fo:block>
<fo:block page-break-after="always">
Inhalt 1.
                Seitenfolge
</fo:block>
<fo:block page-break-after="always">
Inhalt 1. Seitenfolge
</fo:block>
</fo:flow>
</fo:page-sequence>
<fo:page-sequence master-reference="Inhalt-Seiten.master2" font-size="10pt">
<fo:static-content flow-name="rest.before">
<fo:block margin-top="2mm" text-align="center" font-size="16pt">
 Seitenvorlage:
              
<fo:inline font-weight="700">
übrige Seiten
</fo:inline>
;
                page-position="
<fo:inline font-weight="700">
rest
</fo:inline>
" 
</fo:block>
</fo:static-content>
<fo:static-content flow-name="any.before">
<fo:block margin-top="2mm" text-align="center" font-size="16pt">
 Seitenvorlage: 
<fo:inline font-weight="700">
alle Seiten
</fo:inline>
; page-position="
<fo:inline font-weight="700">
any
</fo:inline>
" 
</fo:block>
</fo:static-content>
<fo:flow flow-name="xsl-region-body">
<fo:block page-break-after="always">
Inhalt 2.
                Seitenfolge
</fo:block>
<fo:block page-break-after="always">
Inhalt 2. Seitenfolge
</fo:block>
<fo:block page-break-after="always">
Inhalt 2.
                Seitenfolge
</fo:block>
<fo:block>
Inhalt 2. Seitenfolge
</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>

Download the examples

In the output:

Page 2

Page 3

Page 4

Page 5

Page 6

Page 7

Page 8

Page 9

Page 10

Page 11

Excerpt from the W3C Recommendation:

More information online about

Introduction: "Page layout">

Practical example: "Page masters and simple page sequence masters">

Practical example: "Complex page sequence masters">

Practical example: "Multi-column pages with column rules">

Rendering of the property in the XSL-FO reference

back to top