AFP Extensions

Extensions provide support for constructs that are not addressed by the XSL-FO standard. This provides a mechanism to render AFP specific tags into the resulting document.

AFP extensions use the "afp:" namespace identifier. To use any of the AFP extensions, add a namespace entry for http://org.apache.fop/extensions/afp to the root element:

<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"
            xmlns:afp="http://org.apache.fop/extensions/afp">

Where the AFP extensions are placed within your formatted object is not important. The reason for this is that the extensions work by being associated with an "id" attribute of an fo element, for the AFP extensions to work, the "id" attribute on the extension must correspond to an "id" attribute on an fo element within the document. In other words, the "id" attribute actually creates the "view" within the AFP document.

Tag Logical Element

The Tag Logical Element (TLE) structured field supports the tagging of pages and page groups with an attribute that may be used as an index key. The TLE structured field can be embedded directly in a page or a page group. The TLE structured field does not provide any presentation specifications and therefore has no effect on the appearance of a document when it is presented.

An example of including a tag logical element in a page:

<afp:page id="PAG001">
        <afp:tag-logical-element name="key" value="value"/>
</afp:page>

Then in the formatted object create a block element that will render on the page on which the TLE is to be included, the attribute "id" must correspond to the afp:page element:

<fo:block id="PAG001"/>

See Page Group below for an example of adding a TLE to a page group

Page Group

A page group is used in the data stream to define a named, logical grouping of sequential pages. Page groups are delimited by begin-end structured fields that carry the name of the page group. A page group can only be associated with the fo:page-sequence element. Typically a page group may be added to a document to support document indexing by adding a TLE element to the group. A TLE specifies object attribute information that can be used to support attribute-based document indexing and attribute-based document navigation.

An example of including a page group with a tag logical element:

<afp:page-group id="PGG001">
        <afp:tag-logical-element name="key" value="value"/>
</afp:page-group>

Then on the fo:page-sequence you include the attribute "id" corresponding to the "id" of the afp:page-group

<fo:page-sequence id="PGG001" master-reference="Chapter1">

Include Page Overlay

Overlays are page resource objects that contain data objects and that define their own environment parameters. Include Page Overlays (IPO) may are included on the logical page presentation space using the IPO structured field. The IPO structured field references an overlay resource definition that is to be positioned on the page.

An example of including an include page overlay:

<afp:include-page-overlay id="IPO001" name="O1XXXXXX"/>

Then in the formatted object create a block element that will render on the page on which the overlay is to be include, the attribute "id" must correspond to the afp:include-page-overlay element:

<fo:block id="IPO001"/>

Include Page Segments

Page segments are resource objects that contain data objects. Page segments can be included on the logical page presentation space using the Include Page Segment (IPS) structured field, and inherit the environment parameters defined by the including page. The IPS specifies a reference point on the including page coordinate system that may be used to position objects contained in the page segment.

An example of including an include page overlay:

<afp:include-page-segment id="IPS001" name="XXXXXXXX"/>

Then in the formatted object create a block element that will render on the page on which the segment is to be include, the attribute "id" must correspond to the afp:include-page-segment element. Note that the position of the block element will be used to determine the co-ordinates of the IPS, therefore use the start-indent, space-before.optimum, width and height attributes to position the IPS correctly.

<fo:block id="IPS001"/>