Page Regions in XSL-FO Options

codeling Posts: 1089 Points: 4569
Posted: Tuesday, March 22, 2016 9:08:15 AM

XSL-FO uses the following elements to define the regions of a page:

  • <fo:region-body> defines the body region
  • <fo:region-before> defines the top region (header)
  • <fo:region-after> defines the bottom region (footer)
  • <fo:region-start> defines the left region (left sidebar)
  • <fo:region-end> defines the right region (right sidebar)

Only fo:region-body is required.  The followingfigure shows one arrangement of the regions:

Note: region-before, region-after, region-start, and region-end is a part of the region-body. To avoid text in the region-body to overwrite text in the other regions, the region-body must have margins at least the size of these regions.


codeling Posts: 1089 Points: 4569
Posted: Tuesday, March 22, 2016 9:13:00 AM

Regions have default names

Regions have names, and content is directed to the page regions based on the region’s name. The following figure shows the default, initial name for each page region FO, which just happens to look a lot like the FO’s name, such as “xsl-region-body” for fo:region-body.


codeling Posts: 1089 Points: 4569
Posted: Tuesday, March 22, 2016 9:24:13 AM

Use your own names

But you don’t have to stick with the initial names. You can define the regions with any name, such as “my-before”, “my-end”, or even “George”, provided it’s:

  • A valid name. It has to be, in XML terminology, a NCName, which means, e.g., it can’t contain a colon and has to start with a letter (or other allowed character).
  • Unique within the region names for the page master
  • Not the initial name for a different class of region: i.e., you can’t call your fo:region-before “xsl-region-after” and expect things to work

An additional proviso that works across page masters is that you can’t use the same name on different region types on different page masters. So “George” can’t be a fo:region-before on one page master and fo:region-start on another.

The flip-side of the proviso above is that you can use the same region name for the same region on different page masters.  


codeling Posts: 1089 Points: 4569
Posted: Monday, September 25, 2017 9:28:33 AM

The margins you set for the region-body must be greater than or equal to the extents of the the region-before and region-after. If you do something like this:

<fo:region-before extent="1cm"/>

<fo:region-after extent="1cm"/>

<fo:region-body

    margin-top="0.20cm"

    margin-bottom="0.20cm" />

you can expect results like

Text overwrites heading
Users browsing this topic
Guest