Mark Johnson
Many people consider XSL a language for turning XML into HTML. They
think of and use XSL as a high-octane version of CSS (Cascading Style
Sheets). Besides being a fully functional (pun intended) programming
language though, XSL, in a sense, is two languages.
You probably know about XSLT, which transforms XML to produce a new
structure (usually another XML or HTML document). XSL Flow Objects (XSL-
FO) is XSL's more obscure half; it turns XML into high-quality print.
Flow objects stem from DSSSL, SGML's LISP-like style language. XML-FO
is an entire language that describes page geometries such as page
sizes, printable areas, headers, footers, margins, gutters, and
columns. XSL-FO lets you describe the layout of such page elements in
minute detail that you can specify the page areas designated for text
and "flow" text into them, like water flowing into a pitcher. Having
such strictly defined objects allows a page to be very precisely
described.
The XSL-FO language uses tags for just about any tool you use to put
ink on a page. You can control columns and gutters, font styles and
sizes, kerning, borders, colors, lines with end caps, page breaks,
images, text block alignment, and justification.
XSL-FO can be intimidating at first because you have to learn some
background concepts like "layout masters" and "page sequences". Once
you understand the basic model though, writing XSLT stylesheets that
transforms your XML document to XSL-FO (which itself is another XML
format) is easy.
But what can you do with an XSL-FO file? Since the XSL-FO definition so
strictly defines the XSL-FO tags, page-rendering software can read XSL-
FO files and produce high-quality graphical representations of the
documents. Also, a conversion program can read the XSL-FO definition
and convert it to PDF, PostScript, TeX, or any other page description
language, and then print or display it.
At least two XSL-FO-to-PDF rendering products now exist. The Apache
Software Foundation offers FOP, a Java implementation of an XSL-FO-to-
PDF renderer. As open-source freeware, you can modify FOP's source code
and contribute to the program once you downloaded the binary form from
http://xml.apache.org/fop/index.html. You do, however, need Java and
some other components to run FOP.
XEP is an excellent and clear introduction to XSL-FO produced by
RenderX. XEP is a commercial option but a free evaluation version is
available at http://www.renderx.com/FO2PDF.html. RenderX also offers an
XSL-FO tutorial at http://www.renderx.com/tutorial.html.
XSL-FO gives you professional control of your page layout. If you have
XML data sources that you'd like to style, then consider using XSL-FO
to format your XML for formatting and printing.