A simple FO document

A renderer for printed output from XML content also needs instructions how to format the different elements. A common way to define these formatting properties is by using Formatting Objects (FO) standard. FO documents may be compared to HTML. A HTML document has to be rendered by a piece of software called a browser in order to be viewed as an image. Likewise FO documents have to be rendered by a piece of software called a formatting objects processor which typically yields PostScript or PDF output. As a starting point we take a simple example:

Figure 991. The most simple FO document Create comment in forum
<?xml version="1.0" encoding="utf-8"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">

  <fo:layout-master-set>
    <!-- Define a simple page layout -->
    <fo:simple-page-master master-name="simplePageLayout"
      page-width="60mm"   page-height="100mm">
      <fo:region-body/>
    </fo:simple-page-master>
  </fo:layout-master-set>
  <!-- Print a set of pages using the previously defined layout -->
  <fo:page-sequence master-reference="simplePageLayout">
    <fo:flow flow-name="xsl-region-body">
      <fo:block>Hello, World ...</fo:block>
    </fo:flow>
  </fo:page-sequence>
</fo:root>

The Oxygenxml IDE supports FO to PDF conversion. You may optionally pipe a XSL transformation result to a FO processor by defining a single transformation scenario. Watch out for the Fo Processor tab.