Quantcast

Having discussed important aspects of XSL-FO such as areas, output formats and document structure, today’s tutorial would be devoted to XSL-FO Pages.

XSL-FO basically uses page templates called “Page Masters” to define the layout of pages. Each template must have a unique name. For example, consider the following piece of code:

In the above piece of code, elements define three different templates. Each template (page-master) has a different name. The first template is called “intro”. It could be used as a template for introduction pages. The second and third templates are called “left” and “right”. They could be used as templates for even and odd page numbers.

To define the size of a page, XSL uses page-width to define the width of a page and page-length for the length of a page. Among the attributes, margin-top is used to define the top margin, and margin-bottom for the bottom margin. Also, margin-left and margin-right are used for left and right margins respectively.

XSL also has regions attribute to define the regions of a page. For example, region-body defines the body region and region-before defines header. Besides, region-after defines bottom and region-start and region-end define the right and left regions respectively. An important thing to consider is that region-before, region-after, region-start, and region-end is part of the body region. To avoid text in the body region to overwrite text in these regions, the body region must have margins at least the size of these regions.

Consider the following example for above-mentioned attributes:

The above code defines a “Simple Page Master Template” with the name “A4”. The width of the page is 300 millimeters and the height is 230 millimeters. The top, bottom, left, and right margins of the page are all 1 centimeter. The body has a 3 centimeter margin (on all sides). The before, after, start, and end regions (of the body) are all 2 centimeters. The regions are usually part of the page body.

Pages play the most crucial rule in XSL documentation. In a future tutorial, we would discuss some other important aspects of XSL-FO.

Looking for a quality hosting service? here are a few I suggest.
BlueHost | HostGator | Media Temple