Tranforming XML Files with XSLT Stylesheets

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

The FOP package also contains another XML tool called "xalan". It can be used to transform an XML file based the transformation templates defined in an XSL file. To run "xalan", create a batch file, xalan.bat, with the following command:

java -cp \local\fop-0.20.5rc2\lib\xercesImpl-2.2.1.jar;
   org.apache.xalan.xslt.Process %1 %2 %3 %4 %5 %6

Now let's run "xalan" to transform hello_xsl.xml with hello_fo.xml:

xalan -in hello_xsl.xml -xsl hello_fo.xsl -out hello.out

Open hello.out with a text editor, you will see:

<?xml version="1.0" encoding="UTF-8"?>
<fo:root xmlns:fo=""><fo:layout...
   -Hello world!-

This is exactly what I expected. The output generated from the transformation template contains the formatting objects and information from the source XML file. Note that the format is not well maintained during the transformation. The first line is too long, I have to truncate it.

So if you have some data organized in an XML file, you can write an XSL file with transformation templates to re-organize the data. In the same XSL file, you can also put some formatting objects to format the re-organized data into a pintable format.

You can finish the transformation and formatting process in two steps:

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


 Full Version in PDF/ePUB