1. Computing

Discuss in my forum

XSL-FO Glossary of Important Terms

Understanding XSL-FO – Part 7

By

Extensible Stylesheet Language Formatting Objects (XSL-FO) — XSL-FO is one subset of XSL that concentrates on presenting data for screen or print. A core XML document stores information and XSL provides style and formatting to present that information.

Declaration Statement — Like all XML documents, XSL-FO begins with a standard declaration statement.

<?xml version="1.0"> — barebones declaration statement

Root Element — XSL-FO uses a static root element. In other words, the root will be the same for every document written in this language. It contains the root plus the namespace declaration.

<fo: root xmlns:fo="http://www.w3.org/1999/Format"> — root element and declaration statement 

Regions — Regions are blocks assigned to a virtual output page for XML information. Utilizing regions as a design tool helps you visualize the structure of the page to create the formatting. Available regions include:

  • region-body — the main section of the page
  • region-before — the header section
  • region-after — the footer section
  • region-start — sidebar section to the left
  • region-end — sidebar section to the right

Template — Templates in XSL-FO are the formatting instructions to display the information from the core XML file. In other words, if you were creating an inventory page, the template would include instructions to display the inventory and the core page would contain the actual inventory items. You can design as many templates as needed within one XSL-FO document.

Layout-master-set — Layout-master-set is the first element of an XSL-FO document. Unlike typical XML files, XSL-FO has static element tags that help to structure the output page. Layout-master-set creates the container for the templates to display the information in the XML file. Layout-master-set is the parent element of simple-page-master.

Simple-page-master — The child element of layout-master-set. Simple-page-master supplies the master-name for each template. This name makes the template unique and is used throughout the XSL-FO page to identify the templates. The margins for each template are listed as attributes to the simple-page-master element.

<fo:layout-master-set>
<fo:simple-page-master master-name="myPage1" page-width="8.5in" page-height="11in">

Page-Sequence — Page-sequence is the heart of the design process in XSL-FO. This creates the flow of the templates and the blocks of data. Page-sequence is the parent element to flow and block. The attribute master-reference refers to the template name assigned within the element tag simple-page-master.

Flow — Flow is the child element to page-sequence and the parent element to block. Flow is the tag that establishes the region for each section of information. Create a separate flow element as needed for each region of the page. Not all regions need to be formatted. Regions without a flow element tag will be whitespace.

Block — Block is the child element to flow and holds the data that the viewer sees on the page. Design elements, such as font and colors, are attributes to block. Create a separate block element as the formatting changes within each template. For example, if you change fonts or background colors, you create a new block.

<fo:page-sequence master-reference="myPage1">
<fo:flow flow-name="xsl-region-body">
<fo:block font-size="14pt" font-family="arial">
Hello World!

Closing Tags — XSL-FO is written with the same rules as all XML document, elements must have a closing tag.

<fo:layout-master-set>
<fo:simple-page-master master-name="myPage1" page-width="8.5in" page-height="11in">
</simple-page-master>
</layout-master-set>

<fo:page-sequence master-reference="myPage1">
<fo:flow flow-name="xsl-region-body">
<fo:block font-size="14pt" font-family="arial">
Hello World!
</block>
</flow>
</page-sequence>
  1. About.com
  2. Computing
  3. Web Design / HTML
  4. XML
  5. XSLT
  6. XSL-FO
  7. Glossary of Terms for XSL-FO

©2014 About.com. All rights reserved.