<?xml version="1.0"?>
<!DOCTYPE TEI.2 SYSTEM "teixlite.dtd"
[ 
 <!ATTLIST xref url CDATA #IMPLIED>
 <!ATTLIST xptr url CDATA #IMPLIED>
 <!ATTLIST figure file CDATA #IMPLIED>
 <!ATTLIST table tex CDATA #IMPLIED>
 <!ATTLIST figure width CDATA #IMPLIED>
 <!ATTLIST figure height CDATA #IMPLIED>
 <!ENTITY mdash "&#8212;">
 <!ENTITY pound "&#163;">
 <!ENTITY ldots "&#8230;">
]> 
<TEI.2>
  <teiHeader>
    <fileDesc>
      <titleStmt>
        <title>XSL Formatting Objects</title>
      </titleStmt>
      <publicationStmt>
        <p> </p>
      </publicationStmt>
      <sourceDesc>
        <p></p>
      </sourceDesc>
    </fileDesc>
    <revisionDesc>
      <list>
        <item><date>July 2001</date> revised</item>
      </list>
    </revisionDesc>
  </teiHeader>
  <text>
<front>
<titlePage>
<docTitle>
 <titlePart type="main">XSL Formatting Objects</titlePart>
</docTitle>
<docAuthor>Sebastian Rahtz</docAuthor>
<docDate>July 2001</docDate>
</titlePage>
</front>
<body>

<div rend="slide">
<head>How does XSL FO work?</head>
<p><figure rend="inline" file="xmltoxslfo"/></p>
</div>

<div rend="slide">
<head>Core principles of XSL FO</head>
<p>
<list>
<item>Conceptual compatibility with DSSSL</item>
<item>Compatibility with CSS properties</item>
<item>Screen properties as well as print</item>
<item>No compromises on internationalization</item>
<item>Closely linked to XSLT transformation language</item>
</list>
Provides an <emph>abstract formatting language.</emph>
</p>
</div>

<div rend="slide">
<head>The FO output tree</head>
<p>The input is transformed into an output tree consisting of:
<list>
<item><ident>page masters</ident>, which define named styles of page
layout; and </item>
<item><ident>page sequences</ident>, which reference a named page
layout and contain a <ident>flow</ident> of text. Within that 
<ident>flow</ident>, text is assigned to one of five (rectangular)
<ident>regions</ident>
(the page body, areas at the top, bottom, left and right)</item>
</list>
We also have allowance for floating objects (at the top of the page),
and footnotes (at the bottom), and the model covers writing in left/right
and/or top/bottom modes.
	</p>
</div>

<div rend="slide">
<head>Inside regions and blocks</head>
<p>
Within a region of text, we find one or more
<list>
<item><ident>blocks</ident></item>
<item><ident>tables</ident></item>
<item><ident>lists</ident> and </item>
<item><ident>floats</ident></item>
</list>
and within a block, we find
<list>
<item><ident>inline sequences</ident></item>
<item><ident>characters</ident></item>
<item><ident>links</ident></item>
<item><ident>footnotes</ident> and</item>
<item><ident>graphics</ident></item>
</list>
</p>
</div>

<div rend="slide">
<head>Object properties</head>
<p>
<list>
<item>aural properties</item>
<item>borders, spacing and padding</item>
<item>breaking</item>
<item>colors</item>
<item>font properties (family, size, shape, weight etc)</item>
<item>hyphenation</item>
<item>positioning</item>
<item>special table properties</item>
<item>special list properties</item>
</list>
<hi>BUT</hi> supporting  all of them is not mandatory.
</p>
</div>

<div rend="slide">
<head>Simple example</head>
<p>Take this bit of TEI input
<eg><![CDATA[
<p>The <gi>corr</gi> element marks 
<corr sic="a mistake">correction</corr></p>
]]></eg>
and transform it, as an interpretation of
what the <gi>corr</gi> element is supposed to do, with the following
XSLT template.
</p>
</div>

<div rend="slide">
<head>Sample XSLT template</head>
<eg><![CDATA[
<xsl:template match="corr">
  <xsl:text>[</xsl:text><xsl:apply-templates/><xsl:text>]</xsl:text>
    <fo:footnote>
     <fo:footnote-citation>
      <fo:inline font-size="8pt" vertical-align="super">
         <xsl:number format="a" level="any" count="corr"/>
      </fo:inline>
     </fo:footnote-citation>
     <fo:footnote-body>
     <fo:block>
        <fo:inline font-size="8pt" vertical-align="super">
          <xsl:number format="a" level="any" count="corr"/>
        </fo:inline>
       <fo:inline font-family="Helvetica" font-size="10pt">
                 <xsl:value-of select="@sic"/>
        </fo:inline>
     </fo:block>
     </fo:footnote-body>
    </fo:footnote>
</xsl:template>]]></eg>
</div>

<div rend="slide">
<head>Sample FO output</head>
<eg><![CDATA[
<fo:block font-size="12pt" text-align="justify" text-indent="1em" space-before="0pt">
The <fo:inline color="green" font-family="Courier">corr
</fo:inline> element marks [correction]
<fo:footnote>
<fo:inline font-size="8pt" vertical-align="super">a</fo:inline>
<fo:footnote-body>
<fo:block>
<fo:inline font-size="8pt" vertical-align="super">a</fo:inline>
<fo:inline font-family="Helvetica" font-size="10pt">a mistake</fo:inline>
</fo:block>
</fo:footnote-body>
</fo:footnote></fo:block>]]>
</eg>
</div>

<div rend="slide">
<head>Sample rendition</head>
<p>
<figure rend="inline" width="14cm" file="ex.png"/>
</p>
</div>

<div rend="slide">
<head>FO implementations</head>
<p>We know of six XSLFO implementations:
<list type="ordered">
<item>RenderX's <emph>XEP</emph>,
probably the most complete and reliable</item>
<item>Apache's <emph>FOP</emph>
open source Java, creating PDF or AWT,
with a large amount of the XSLFO specification implemented.</item>
<item>Sebastian Rahtz' <emph>PassiveTeX</emph>,
a library of TeX macros which
interpret XSLFO;</item>
<item>Unicorn's XSLFO engine 
also uses TeX, but works by generating a normal TeX file from
an internal FO tree.</item>
<item>Arbortext's <emph>Epic</emph> is not yet in widespread use
and its coverage of the specification is unknown</item>
<item>Antenna House's <emph>XSL Formatter</emph> is different in that it formats for the
screen, using Windows GDI calls. It has good coverage of the specification
(albeit not complete), and is fairly robust.</item>
</list>
From which we can see that there is no 100% reliable implementation 
of the Candidate specification.
</p>
</div>

<div rend="slide"  >
<head>Sample 1: PassiveTeX</head>
<p> <figure rend="inline" width="6in" file="pt1"/></p>
</div>

<div rend="slide"  >
<head>Sample 1: FOP</head>
<p> <figure rend="inline" width="6in" file="fop1"/></p>
</div>

<div rend="slide"  >
<head>Sample 1: XEP</head>
<p> <figure rend="inline" width="6in" file="xep1"/></p>
</div>

<div rend="slide"  >
<head>Sample 1: Antenna House</head>
<p> <figure rend="inline" width="6in" file="anthouse2"/></p>
</div>

<div rend="slide">
<head>Discussion 1</head>
<p>The results are within fairly acceptable limits, though XEP's inability
to hyphenate shows clearly how vital a good H&amp;J engine is -  the 
word and letter spacing on the 3rd line from the end 
is clearly unacceptable. 
</p>
<p>Let us now decrease the page width, and look at a harder paragraph.
</p>
</div>

<div rend="slide"  >
<head>Sample 2: PassiveTeX</head>
<p> <figure rend="inline" width="6in" file="pt2"/></p>
</div>

<div rend="slide"  >
<head>Sample 2: FOP</head>
<p> <figure rend="inline" width="6in" file="fop2"/></p>
</div>

<div rend="slide"  >
<head>Sample 2: XEP</head>
<p> <figure rend="inline" width="6in" file="xep2"/></p>
</div>

<div rend="slide"  >
<head>Sample 2: Antenna House</head>
<p> <figure rend="inline" width="6in" file="anthouse1"/></p>
</div>

<div rend="slide"><head>Discussion 2</head>
<p>The results show two rather different formatting decisions
taking place in FOP and XEP. The former opts to abandon
sensible line breaking, and let the URL stick out into the margin, but
XEP forces itself to extreme lengths to justify with letter spacing, while
Antenna House makes an arbitrary break.</p>
</div>

</body>
</text>
</TEI.2>


