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

Example of XSL-FO Document -

This section provides a simple XSL-FO (XSL Formatting Objects) document,

Here is my first example of XSL-FO document,

<?xml version="1.0" encoding="utf-8"?>
<fo:root xmlns:fo="">
  <fo:simple-page-master master-name="my_page" margin="0.5in">
 <fo:page-sequence master-reference="my_page">
  <fo:flow flow-name="xsl-region-body">
   <fo:block>Hello world!</fo:block>

Note that:

  • XSL-FO document is an XML document with the root element named as "fo:root".
  • All the element names are prefixed with "fo:".
  • Prefix "fo:" is associated with the XML name space: "". This is done by the attribute, "xmlns:xsl" in the root element.
  • Other "fo:" elements are used to provide page formatting information.

The next question is then do we have an application that can process this XSL-FO file to format the embedded information? I tried the following:

  • I don't know how to make IE to work with XSL-FO.
  • I don't know how to make XML Spy to work with XSL-FO. It can be used to edit XSL-FO files. But how to preview the formatted output?
  • I searched the Internet and located FOP from Apache. It can be used to format XSL-FO file into PDF files.

Table of Contents

 About This Book

 Ideas on Publishing Books using XML

 Overview of hyPub - A Simple XML Publishing Tool

 Writing Book Contents in XHTML Source Files

 Transforming Book Source Files with XSL Technology

 Designing Web Page Layouts with Tables

 Controlling Web Page Appearance with CSS

 Sharing HTML Codes with JavaScript Files

 Generating Web Pages with hyPub

Formatting Printable Documents with XSL-FO

 What Is XSL-FO (XSL Formatting Objects)

Example of XSL-FO Document -

 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

 Generating PDF Documents with hyPub

 Areas of Future Improvements


 PDF Printing Version

Dr. Herong Yang, updated in 2007
Example of XSL-FO Document -