Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

XSL-FO region-body object


May 28, 2021 XSL-FO


Table of contents


XSL-FO region-body object

XSL-FO region-body object XSL-FO reference manual

When using XSL-FO, the body area of a page is defined by the region-body object.


Definitions and usages

The object defines the body area of the page.

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

  • The subject area is defined by the region-body
  • The top area (header) is defined by the region-before
  • The bottom area is defined (footer)
  • The area at the left is defined (left column)
  • The area at the right end is defined (right column)

Note: region-before, region-after, region-start, and region-end are all part of region-body. To avoid text within region-body overwriting text in other areas, the margins within region-body must be at least the same size as the four sub-regions above.

Tip: In order to provide multiple columns in the region-body zone, you need to set the column-count property to greater than 1! / p>

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

Note: The padding and border-width properties must be 0 according to the recommended standards for the XSL-FO 1.0 version.


Grammar

<fo:region-body>
<!--
Contents:EMPTY
-->
</fo:region-body> 

Property

Attribute [A-B] Attribute [C-Z]
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

Instance 1

XSL-FO uses a page template called "Page Masters" to define the layout of the page. 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 example above, three elements, the simple-page-master-gt; element, 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 introductory pages.

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

Instance 2

This is a piece 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 code above defines a Simple Page Master Template with the name "A4".

The width of the page is 297 mm and the height is 210 mm.

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

The margin of the body is 3 cm (all four sides are).

The body's before, after, start, and end regions are all 2 cm.

The width of the body in the instance above can be calculated by subtracting the left and right margins from the page width and the margins of the region-body:

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

Note that region-start and region-end are not counted in. As explained earlier, these areas are part of the body.


XSL-FO region-body object XSL-FO reference manual