Latest web development tutorials

XSL-FO region-body objects

XSL-FO Reference Manual XSL-FO Reference Manual

Definition and Usage

<Fo: region-body> object defines the main area of ​​the page.

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

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

NOTE: region-before, region-after , region-start and region-end part is the region-body.To avoid the text within the region-body text overlays other areas, region-body padding must be at least the size of the four sub-regions of the same.

Tip: In order to provide a plurality of columns in the region-body region, need to be column-count property is set to more than 1! / P>

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

Note: Depending onthe version of XSL-FO 1.0 Recommendation, padding and border-width attribute must be zero.


grammar

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

Attributes

属性 [A-B] 属性 [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

Example 1

XSL-FO uses page templates 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, the three <fo: simple-page-master> element defines three different templates. Each template (page-master) has a different name.

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

The second and third templates called "left" and "right". They can be as even and odd numbered pages template.

Example 2

This is a fragment 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 name for the "A4" of "Simple Page Master Template".

Page width is 297 mm, height 210 mm.

Four page margins (margins on the bottom, left margin, right margin) is 1 cm.

Margins body is 3 cm (all four sides).

before the body, after, start and end zones are 2 cm.

The width of the main examples above may be reduced by about margins and the region-body margins calculated by the width of the page:

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

Please note, region (region-start and region-end) is not counted. As previously explained earlier, these zones (region) is an integral part of the body.


XSL-FO Reference Manual XSL-FO Reference Manual