Publishing Books Using XML Technologies
Dr. Herong Yang, Version 4.01

What Is XSL-FO (XSL Formatting Objects)

This section provides a brief introduction of the XSL-FO (XSL Formatting Objects) technology.

XSL-FO: An XML based markup language that defines how the embedded information should be formatted for viewing or printing. XSL-FO is very similar to TeX, which was a very popular language 15 years ago for writing well formatted scientific documents.

Main features of XSL-FO:

1. XSL-FO is XML based. So an XSL-FO document is also an XML document.

2. XSL-FO documents requires to an XSL-FO processor to comile them into new output formats that are suitable for viewing or printing. Common XSL-FO output formats are text, PDF and PS files.

3. XSL-FO can be embedded inside XSL transformation stylesheet files. In this case, the content source XML file will be processed in 2 steps in order to get the viewing or printing output files:

  • The content source XML file will be transformed according to the stylesheet file - the resulting file, XSL-FO file, will contain the transformed content with XSL-FO statements.
  • The XSL-FO file will be compiled by XSL-FO processors into viewing or printing output files.

The 2-step process can be viewed as in this diagram:

   Content source (XML format)
      |
      |   XSLT stylesheet with XSL-FO statements
      |      |
      |      v      
      |<- XSLT transforming 
      |
      v
   Content with XSL-FO statements (XML format)
      |
      |<- XSL-FO processing 
      |
      v
   Printing document (PDF format) 

Sections in This Chapter

What Is XSL-FO (XSL Formatting Objects)

Example of XSL-FO Document - hello.fo

Installing Apache FOP - XSL-FO Processor

Formatting XSL-FO Files to Text Files Using FOP

Formatting XSL-FO Files to PDF Files Using FOP

Formatting XML Files to PDF Files with XSLT

Tranforming XML Files with XSLT Stylesheets

Dr. Herong Yang, updated in 2007
What Is XSL-FO (XSL Formatting Objects)