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

Formatting XSL-FO Files to Text Files Using FOP

This section provides an example of formatting an XSL-FO file to a text file with FOP.

Let's format hello.fo into a text file with the following command:

fop -fo hello.fo -txt hello.txt

You should see the following on the screen:

[INFO] Using org.apache.xerces.parsers.SAXParser as SAX2 Parser
[INFO] FOP 0.20.5rc2
[INFO] Using org.apache.xerces.parsers.SAXParser as SAX2 Parser
[INFO] building formatting object tree
[INFO] setting up fonts
[INFO] rendering areas to TEXT
[INFO] [1]
[INFO] Parsing of document complete, stopping renderer
[INFO] writing out TEXT

The output tells us that the xerces SAXParser was used to parse the XSL-FO file, and one page of output was formatted.

If you open the output file, hello.txt, with any text editor, you should see:




        Hello  world!
...

This is perfect.

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 - 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

 Generating PDF Documents with hyPub

 Areas of Future Improvements

 References

 PDF Printing Version

Dr. Herong Yang, updated in 2007
Formatting XSL-FO Files to Text Files Using FOP