# Elementname: `Pagetype`

## Description

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

Allowed attributes: defaultcolor, name, test

Child elements: AtPageCreation, AtPageShipout, ForAll, Grid, Margin, PositioningArea

Parent elements: AtPageCreation, AtPageShipout, Contents, Include, Layout, Record, SavePages

### Attributes

defaultcolor (text, optional, since version 2.9.3)

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

name (text)

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

test (XPath Expression)

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

### Remarks

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.

## Example

    <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"/>
      </PositioningArea>
      <AtPageCreation>
        <PlaceObject column="1">
          <!-- header -->
        </PlaceObject>
      </AtPageCreation>
      <AtPageShipout>
        <PlaceObject column="1">
          <!-- footer -->
        </PlaceObject>
      </AtPageShipout>
    </Pagetype>

## See also

XPath expressions, AtPageCreation, AtPageShipout, PositioningArea, NewPage

# Commands

- A
- Action
- AddSearchpath
- AtPageCreation
- AtPageShipout
- AttachFile
- Attribute
- B
- Barcode
- Bold
- BoldItalic
- Bookmark
- Box
- Br
- Case
- Circle
- Color
- Column
- Columns
- Compatibility
- Contents
- Copy-of
- DefineColor
- DefineColorprofile
- DefineFontalias
- DefineFontfamily
- DefineTextformat
- Element
- Fallback
- Fontface
- ForAll
- Frame
- Grid
- Group
- Groupcontents
- HSpace
- Hyphenation
- I
- Image
- Include
- Initial
- InsertPages
- Italic
- Layout
- Li
- LoadDataset
- LoadFontfile
- Loop
- Makeindex
- Margin
- Mark
- Message
- NewPage
- NextFrame
- NextRow
- NoBreak
- Ol
- Options
- Otherwise
- Output
- Overlay
- PDFOptions
- Pageformat
- Pagetype
- Paragraph
- PlaceObject
- Position
- PositioningArea
- PositioningFrame
- ProcessNode
- Record
- Regular
- Rule
- SaveDataset
- SavePages
- SetGrid
- SetVariable
- SortSequence
- Span
- Stylesheet
- Sub
- Sup
- Switch
- Table
- TableNewPage
- Tablefoot
- Tablehead
- Tablerule
- Td
- Text
- Textblock
- Tr
- Trace
- Transformation
- U
- URL
- Ul
- Until
- VSpace
- Value
- While

Version: 3.8.0 | Start page | Command reference | Other language: German