Pages in XSL-FO

The layout of XSL-FO pages are defined via <fo:simple-page-master> elements or page templates (Page Masters). Each template has its unique name. The sequence of pages is defined via <fo:page-sequence> element.

  <fo:simple-page-master master-name="cover" page-height="297mm" page-width="210mm" 
	  margin-top="20mm" margin-left="20mm" margin-right="15mm" margin-bottom="20mm">
     <fo:region-body margin="20mm 10mm" />

  <fo:simple-page-master master-name="even" page-height="297mm" page-width="210mm" 
	  margin-top="16.5mm" margin-left="15mm" margin-right="25mm" margin-bottom="16.5mm">
     <fo:region-body margin-top="8mm" margin-bottom="8mm" />

  <fo:simple-page-master master-name="odd" page-height="297mm" page-width="210mm" 
	  margin-top="16.5mm" margin-left="25mm" margin-right="15mm" margin-bottom="16.5mm">
     <fo:region-body margin-top="8mm" margin-bottom="8mm" />

Page size

The size of a page is defined via the following XSL-FO attributes:

  • page-width
  • page-height

Page margins

The following XSL-FO attributes define the margins of a page:

  • margin-top
  • margin-bottom
  • margin-left
  • margin-right
  • margin (for all margins if they are the same)

Page regions

The following XSL-FO elements are used to define page regions:

  • region-body
  • region-before
  • region-after
  • region-start
  • region-end

Remember that region-body consists of region-before, region-after, region-start and region-end.

In the above example you can see how page size, margins and regions are defined.