Define a master page. A master page is chosen depending on the criterion given with the attribute »test«.

Child elements

AtPageCreation, AtPageShipout, ForAll, Grid, Margin, PositioningArea

Parent elements

AtPageCreation, AtPageShipout, Case, Contents, ForAll, Include, Layout, Loop, Otherwise, Record, SavePages, Until, While


columnordering (optional, since version 4.1.18)

Reverse the logical column ordering if in rtl mode. Only changes areas that are next to each other.


The columns are ordered from first defined to last defined. (default)


Reverse the order of columns. The first defined column will be the last column.

defaultcolor (text, optional, since version 2.9.3)

The default text color for this page (unless overridden in Paragraph or Textblock). Defaults to 'black'.

height (length, optional, since version 4.1.13)

The height of the page. Defaults to the global setting.

name (text)

Name of the master page. It is for informational purpose and as a selection for ClearPage.

part (text, optional, since version 4.3.4)

Set the part of the document for this page type (mainmatter is the default).

test (XPath expression)

If this xpath expression evaluates to true, this page is taken as a master page.

width (length, optional, since version 4.1.13)

The width of the page. Defaults to the global setting.


The contents of the element at AtPageCreation is executed, as soon as something will be placed on the page. The commands inside AtPageShipout are executed when switching to a new page.

When creating a new page, all page types are tried in reversed order. That means that the later defined master pages have a higher priority. This is important if more than one test in a pagetype definition evaluates to true.


<Pagetype name="right page" test=" sd:odd( sd:current-page() ) "/>
<Pagetype name="left page" test=" sd:even( sd:current-page() ) "/>
<Pagetype name="main part right" test=" sd:odd( sd:current-page() ) and $chapter='main' "/>
<Pagetype name="right page" test="sd:odd( sd:current-page() )">
  <Margin left="1cm" right="1cm" top="1cm" bottom="1cm"/>
  <PositioningArea name="frame1">
    <PositioningFrame width="12" height="30" column="2" row="2"/>
    <PositioningFrame width="12" height="30" column="16" row="2"/>
    <PlaceObject column="1">
      <!-- header -->
    <PlaceObject column="1">
      <!-- footer -->

See also

The section Page types and the command DefineMatter.