YouTip LogoYouTip

Obj Region Body

XSL-FO region-body Object

XSL-FO Reference Manual


Definition and Usage

The <fo:region-body> object defines the main body area of a page.

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

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

Note: region-before, region-after, region-start, and region-end are all part of region-body. To prevent text in region-body from covering text in other regions, the margin of region-body must be at least as large as the dimensions of these four sub-regions.

Tips: To provide multiple columns in the region-body, set the column-count attribute to greater than 1!

Note: If the value of the overflow property is "scroll", you cannot set the column-count attribute to greater than 1!

Note: According to the recommended standard of XSL-FO 1.0 version, padding and border-width properties must be 0.


Syntax

<fo:region-body>

<!--

 Contents:EMPTY

 -->

</fo:region-body>

Attributes

Attribute Attribute
background-attachment clip
background-color column-count
background-image column-gap
background-repeat display-align
background-position-horizontal end-indent
background-position-vertical margin-bottom
border-after-color margin-left
border-after-style margin-right
border-after-width margin-top
border-before-color overflow
border-before-style padding-after
border-before-width padding-before
border-bottom-color padding-bottom
border-bottom-style padding-end
border-bottom-width padding-left
border-end-color padding-right
border-end-style padding-start
border-end-width padding-top
border-left-color region-name
border-left-style reference-orientation
border-left-width space-after
border-right-color space-before
border-right-style writing-mode
border-right-width
border-start-color
border-start-style
border-start-width
border-top-color
border-top-style
border-top-width

Example 1

XSL-FO uses named "Page Masters" page templates to define the layout of pages. Each template must have a unique name:

<fo:simple-page-master master-name="intro">

<fo:region-body margin="5in" />

</fo:simple-page-master>

<fo:simple-page-master master-name="left">

<fo:region-body margin-left="2in" margin-right="3in" />

</fo:simple-page-master>

<fo:simple-page-master master-name="right">

<fo:region-body margin-left="3in" margin-right="2in" />

</fo:simple-page-master>

In the above example, three <fo:simple-page-master> elements define three different templates. Each template (page-master) has a different name.

The first template is named "intro". It can be used as a template for introduction pages.

The second and third templates are named "left" and "right". They can be used as templates for even and odd numbered pages.

Example 2

This is a snippet extracted from an XSL-FO document:

<fo:simple-page-master master-name="A4"

 page-width="297mm" page-height="210mm"

 margin-top="1cm" margin-bottom="1cm"

 margin-left="1cm" margin-right="1cm">

<fo:region-body margin="3cm"/>

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

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

<fo:region-start extent="2cm"/>

<fo:region-end extent="2cm"/>

</fo:simple-page-master>

The above code defines a "Simple Page Master Template" with the name "A4".

The width of the page is 297 millimeters, and the height is 210 millimeters.

The margins of the page (top, bottom, left, right) are all 1 centimeter.

The margin of the body is 3 centimeters (all sides).

The before, after, start, and end regions of the body are each 2 centimeters.

The width of the body in the above example can be calculated by subtracting the left and right margins and the body's margin from the page width:

297mm - (2 x 1cm) - (2 x 3cm) = 297mm - 20mm - 60mm = 217mm

Please note that the regions (region-start and region-end) are not included in the calculation. As previously explained, these regions (regions) are parts of the body.


XSL-FO Reference Manual

← Obj Region EndObj Region Before β†’