What Is XSL-FO

Editor's Note

I'm pleased to be able to present extended excerpts from Ken Holman's
well known and respected training materials on XSL-FO. For reasons of
internal consistency, we have kept the section numbering from the original
material -- this means that some sections will not be numbered contiguously.

I wish to extend my thanks to Ken for permitting XML.com to publish this
excellent introduction to the W3C's XSL Formatting Objects.

Edd Dumbill, Editor, XML.com

Prologue

We often take the printed form of information for granted,
yet how many of us are satisfied with the print-screen functionality from a web browser? How many times have you printed a lengthy web document and found the paginated result to be as easily navigated as the electronic original?

Navigating a paginated document is very different than navigating a web page, and browser-based navigation mechanisms understandably will not work on printed output. How would we follow a hyperlink when the visible clickable content hides the underlying hyperlink target address?

When we want to produce a paginated presentation of our XML information, we necessarily must offer a different set of navigation tools to the consumers of our documents. These navigational aids have been honed since bound books have been used: headers, footers, page numbers and page number citations are some of the characteristics of printed pages we use to find our way around a collection of fixed-sized folios of information.

This collection of fixed-sized folios may, indeed, have different geometries of page sizes and margin widths used therein, but each page once rendered is fixed in its particular geometry. Layout and typesetting controls give us the power to express our information on pages in a visually pleasing and perhaps meaningful set of conventions conveying information in the presentation itself.

Many aspects of layout are, indeed, applicable on electronic displays and Recommendations such as Cascading Stylesheets (CSS) have defined presentation semantics in areas such as font, margin, and color properties. Paginating marked-up information is not something new, in that the Document Style Semantics and Specification Language (DSSSL) is an international standard for use originally with SGML documents, though it also works unchanged with XML documents.

Accepting that HTML and CSS are suitable and sufficient for browser-oriented rendering of information, the W3C set out to define a collection of pagination semantics for print-oriented rendering. These pagination semantics are equally suitable for an electronic display of fixed-size folios of information, such as page-turner browsers and Portable Document Format (PDF) readers.

The Extensible Stylesheet Language (XSL), also known colloquially in our community as the Extensible Stylesheet Language Formatting Objects (XSLFO), combines the heritage of CSS and DSSSL in a well-thought-out and robust specification of formatting semantics for paginating information.

The Recommendation itself is a rigorous, lengthy, and involved technical specification of the processes and operations engaged by a formatting engine to effect consistent paginated results compared to other formatting engines acting on the same inputs. Well-written for its intended purpose, the document remains out of reach for many people who just want to write stylesheets and print their information.

In its ever-growing collection of training material, Crane Softwrights Ltd. has published Practical Formatting Using XSLFO covering every formatting object of XSLFO and their properties, according to the final XSL 1.0 Recommendation of October 15, 2001. The first two chapters of this book have been rewritten in prose and are made available here as an introduction to the technology and its use. This material assumes no prior knowledge of XSLFO and guides the reader through background, context, structure, concepts, introductory terminology, and a short introduction of each of the formatting objects.

Note that neither the Recommendation itself, nor Crane's training material, attempt to teach facets of typography and attractive or appropriate layout style, only the semantics of formatting, the implementation of those semantics, and the nuances of control available to the stylesheet writer and implemented by the stylesheet formatting tool. XSLFO is a very powerful language with which we can possibly create very ugly or very beautiful pages from our XML-based information.