
XSL formatting objects describe how content occupies pages: their dimensions, margins, regions, blocks, and other layout structures. Learn the model by rendering a small document and changing one property at a time.
Place the XSL 1.0 milestone in context
W3C published XSL 1.0 as a Recommendation on October 15, 2001. XSL 1.1, published in 2006, supersedes it. The formatting vocabulary commonly called XSL-FO uses the namespace http://www.w3.org/1999/XSL/Format.
A typical pipeline transforms source XML into formatting objects, then passes those objects to a formatter that produces PDF or another output. XSLT performs the transformation; the formatter performs layout. You can also write a small FO document directly, as this exercise does, to isolate formatting behavior.
Read the page master
The example defines an A4 sheet, 18-millimeter outer margins, and separate body, header, and footer regions:
<fo:simple-page-master master-name="sheet"
page-width="210mm" page-height="297mm" margin="18mm">
<fo:region-body margin-top="14mm" margin-bottom="12mm"/>
<fo:region-before extent="10mm"/>
<fo:region-after extent="8mm"/>
</fo:simple-page-master>The outer margins leave a 174-by-261-millimeter reference area. Reserving 14 millimeters above and 12 below the body leaves 235 millimeters of body height in this simple layout. The header and footer extents define their regions; the body margins supply clearance from them. An oversized header can still intrude if its content exceeds the space provided.
The page sequence refers to sheet. Repeated header/footer material belongs in fo:static-content; main content belongs in the flow named xsl-region-body. These names connect content to the regions.
Render and compare two pages
Download the complete FO source and the rendered reference PDF. The same source is named layout.fo in the XML labs pack.
Install Java and Apache FOP following the FOP running instructions. From the extracted labs folder, use:
fop -fo layout.fo -pdf layout.pdfThe Windows distribution provides fop.bat. With the standalone source, substitute layout-example.fo. Expect two A4 pages with the same header and footer, numbered 1 and 2. The reference was rendered with Apache FOP 2.11.
The second main heading contains break-before="page". Remove that property in a copy and render again: this short example fits on one page. Restore it to recover the two-page layout. That experiment separates an explicit page break from an overflow caused by content.
Trace a layout problem to its cause
| Symptom | Inspect | Controlled adjustment |
|---|---|---|
| Header overlaps text | Header extent, actual content height, body top margin | Reserve enough body clearance and rerender. |
| Unexpected new page | Break properties, keeps, available body height | Remove one constraint in a copy and compare. |
| Text wraps differently | Font availability, font size, line height, width | Use the same font configuration and formatter version. |
| A glyph is missing | Font coverage and embedding configuration | Choose a supported font and verify the rendered character. |
Keep-with-next can hold a heading with following content, but chains of keeps may move more material than intended. Tables, long identifiers, and unbreakable text also deserve separate examples. Check the formatter's feature support for the exact objects and properties you use.
Keep the source, formatter version, font configuration, and expected page count with the build. Inspect every page after meaningful changes. A successful PDF render establishes neither archival PDF/A conformance nor accessible PDF/UA conformance; those require their own configuration and validation.