"fop -xml -xsl -foout" - XSLT Transformations

This section provides a tutorial on how to run the 'fop -xml -xsl -foout' command to convert an XML file to another XML or text file using a XSLT file with XSLT transformation templates.

Apache™ FOP can also be used to perform generic XSLT transformations using the "fop -xml ... -xsl ... -foout ..." command option.

Here is the full syntax of the "fop -xml ... -foout" command:

fop -xml old.xml -xsl xxx.xsl -foout new.xml
   Transform old.xml to an XML file, new.xml, using xxx.xsl
fop -xml old.xml -xsl xxx.xsl -foout new.txt
   Transform old.xml to a text file, new.txt, using xxx.xsl

To test the "fop -xml ... -xsl ... -foout ..." command option, let's create the following XML file, hello.xml, that contains only data content:

<?xml version="1.1"?>
<p>Hello world!</p>

Then create an XSLT file, hello-xml.xsl, that contains a transformation template to convert hello.xml into another data XML file:

<?xml version="1.1"?>
<xsl:stylesheet version="1.1"
 <xsl:template match="/">
  <p><xsl:value-of select="p"/> - Transformed</p>

Next, run following commands:

herong> fop -xml hello.xml -xsl hello-xml.xsl -foout hello-out.xml

herong> type hello-out.xml
<?xml version="1.0" encoding="UTF-8"?>
<p>Hello world! - Transformed</p>

As you can see from the output, FOP successfully transformed an XML file to another XML file. And it is not related to formatting objects at all.

Table of Contents

 About This Book

 Introduction of XSL-FO

Apache™ FOP (Formatting Objects Processor)

 What Is Apache™ FOP?

 FOP Download and Installation on Windows

 FOP Installation Verification on Windows

 FOP Download and Installation on macOS

 FOP Installation Verification on macOS

 "fop" Command and Options

 "fop -fo" - Formatting XSL-FO Files

 "fop -xml -xsl" - Transformation and Formatting

"fop -xml -xsl -foout" - XSLT Transformations

 RenderX XEP as an XSL-FO Tool

 Introduction of Area Model

 XSL-FO Document Basics and Examples

 Page Layout Masters

 Block-Level Formatting Objects

 Inline-Level Formatting Objects

 Including Graphics in XSL-FO document

 Table of Rows and Columns

 List, Item, Label, and Body

 Floating Blocks - "float" and "footnote"

 Hyperlinks, Table of Contents and Indexes

 Headers and Footers using "static-content"

 Font Attributes and Font Families

 Apache FOP Font Configurations

 RenderX XEP Font Configurations

 Converting HTML to PDF


 Full Version in PDF/ePUB