FOPRunXSLTExt/examples/balisage2014.xml
author Tony Graham
Tue, 29 Jul 2014 00:33:22 +0100
changeset 55 873cf39a5e9c
parent 51 53a9f2fe79d0
child 56 b184e200b875
permissions -rwxr-xr-x
Added 'bogus' function definition to illustrate handling of short
labels. Minor text changes.
<example name="Balisage 2014">
<header>Print and Page Layout <svg href="ppl-logo.svg" id="logo"/> Community Group<lb/>XSLT Extensions</header>

<box id="box001" width="2240pt" height="540pt">
<paragraph id="para001">The XSLT extension functions from the Print and Page Layout Community Group @ W3C (see <url>https://www.w3.org/community/ppl/wiki/XSLTExtensions</url>) allow you to run your XSL-FO formatter within your XSLT transform, and do it as often as you like, to get an area tree and make decisions based on formatted areas to do things like:</paragraph>
<list id="list009">
  <item label="*">Adjust the start-indent of a <code>fo:list-block</code> based on the length of the longest <code>fo:list-item-label</code>; or</item>
  <item label="*">Size this text to be <font-size/> so it fits this box.</item>
</list>
</box>
<box id="box002" width="2240pt" height="630pt" columns="2" border="none">
<title>XSLT and XSL-FO Processors</title>
<paragraph id="para002">The extension is available for Java and DotNet and uses either the Apache FOP XSL formatter or Antenna House AHF formatter to produce the area trees.</paragraph>
<paragraph>The single Java jar file covers four combinations of XSLT processor and XSL-FO formatter:</paragraph>
<list id="list001">
  <item label="*">Saxon 9.5 and FOP</item>
  <item label="*">Saxon 9.5 and Antenna House</item>
  <item label="*">Xalan and FOP</item>
  <item label="*">Xalan and Antenna House</item>
</list>
<paragraph>The DotNet version supports:</paragraph>

<list id="list002">
  <item label="*">DotNet 4.0 and FOP</item>
  <item label="*">DotNet 4.0 and Antenna House</item>
</list>
<title>API</title>
<paragraph>The PPL CG provides <code>ppl:area-tree()</code> for running the formatter and getting the area tree plus a selection of convenience functions to help hide both the details of the area tree and the differences between the area trees of different XSL-FO formatters.</paragraph>
<api-list id="list003">
  <item>
    <function>ppl:area-tree($fo-tree as node()) as document-node()</function>
    <def>Runs the XSL-FO formatter on $fo-tree to get an area tree.</def>
  </item>
  <item>
    <function>ppl:block-by-id($area-tree as document-node(), $id as string) as element()?</function>
<def>Returns the block area with ID $id.</def>
  </item>
  <item>
    <function>ppl:block-bpd($block as element()) as xs:double</function>
    <def>Returns the block-progression-dimension of $block in points.</def>
  </item>
  <item>
    <function>ppl:block-bpd($block as element()) as xs:double</function>
    <def>Returns the inline-progression-dimension of $block in points.</def>
  </item>
  <item>
    <function>ppl:block-available-ipd($block as element()) as xs:double</function>
    <def>Returns the difference, in points, between the inline-progression-dimension of $block and the inline-progression-dimension of its ancestor reference area.</def>
  </item>
  <item>
    <function>ppl:is-first($block as element()) as xs:boolean</function>
    <def>Returns the value of the <code>is-first</code> trait.</def>
  </item>
  <item>
    <function>ppl:is-last($block as element()) as xs:boolean</function>
    <def>Returns the value of the <code>is-last</code> trait.</def>
  </item>
  <item>
    <function>ppl:sum-lengths-to-inches($lengths as xs:string*) as xs:double</function>
    <def>Returns the length, in inches, of the sum of a sequence of lengths represented as strings, e.g., &#x201C;<code>6pt</code>&#x201D;, etc.</def>
  </item>
  <item>
    <function>ppl:sum-lengths-to-pt($lengths as xs:string*) as xs:double</function>
    <def>Returns the length, in points (1/72 of an inch), of the sum of a sequence of lengths represented as strings, e.g., &#x201C;<code>6pt</code>&#x201D;, etc.</def>
  </item>
  <item>
    <function>bogus</function>
    <def>Not a function, just an illustration of how, by using the extension functions to find the formatted size of the function definition, the <code>fo:list-item-body</code> moves down only for long function definitions.</def>
  </item>
</api-list>
</box>
</example>