YouTip LogoYouTip

Xslfo Pages

* * * XSL-FO uses page templates called "Page Masters" to define the layout of pages. * * * ## XSL-FO Page Templates (Page Templates) XSL-FO uses page templates named "Page Masters" to define page layouts. Each template must have a unique name: In the example above, three elements define three different templates. Each template (page-master) has a distinct 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", respectively. They can be used as page templates for even and odd page numbers. * * * ## XSL-FO Page Size XSL-FO uses the following attributes to define page dimensions: * page-width defines the width of the page * page-height defines the height of the page * * * ## XSL-FO Page Margins XSL-FO uses the following attributes to define page margins: * margin-top defines the top margin * margin-bottom defines the bottom margin * margin-left defines the left margin * margin-right defines the right margin * margin defines the margin on all sides * * * ## XSL-FO Page Regions XSL-FO uses the following elements to define page regions: * region-body defines the body region * region-before defines the top region (header) * region-after defines the bottom region (footer) * region-start defines the left region (left sidebar) * region-end defines the right region (right sidebar) Note that region-before, region-after, region-start, and region-end are part of the body region. To prevent text in the body region from overlapping with text in these regions, the body region's margins must be at least as large as the dimensions of the other regions. ![Image 1: Margins and page layout](#) * * * ## XSL-FO Example This is a snippet extracted from an XSL-FO document: The code above defines a "Simple Page Master Template" named "A4". The page width is 297 millimeters, and the height is 210 millimeters. The four margins (top, bottom, left, and right) are each 1 centimeter. The body region has a margin of 3 centimeters (on all sides). The before, after, start, and end regions of the body are each 2 centimeters. The width of the body region in this example can be calculated by subtracting the left and right margins and the body region's margins from the page width: 297mm - (2 x 1cm) - (2 x 3cm) = 297mm - 20mm - 60mm = 217mm Note that the regions (region-start and region-end) are not included in this calculation. As previously explained, these regions are part of the body region.
← Xslfo BlocksXslfo Flow β†’