The following extensions are only used for AFP output file format.
AFP Tagging
AFP-tags are metadata elements used for indexing purposes.
To tag AFP content, the following extensions are used: xf:afp-tagging and xf:afp-tag.
Example of usage:
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xf="http://www.ecrion.com/xf/1.0" xmlns:xc="http://www.ecrion.com/2008/xc" xmlns:svg="http://www.w3.org/2000/svg">
<xf:afp-tagging>
<xf:afp-tag ref-id="page1" key="page" value="page1"/>
<xf:afp-tag ref-id="page2" key="page" value="page2"/>
<xf:afp-tag ref-id="page3" key="page" value="page3"/>
</xf:afp-tagging>
<fo:layout-master-set>
<fo:simple-page-master master-name="Letter Page" page-width="8.500in" page-height="11.000in">
<fo:region-body region-name="xsl-region-body" margin="0.700in" />
<fo:region-before region-name="xsl-region-before" display-align="after" extent="0.700in"/>
<fo:region-after region-name="xsl-region-after" display-align="before" extent="0.700in"/>
<fo:region-start region-name="xsl-region-start" extent="0.700in"/>
<fo:region-end region-name="xsl-region-end" extent="0.700in"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="Letter Page" id="seq1">
<fo:flow flow-name="xsl-region-body" font-family="Times" font-size="12pt">
<fo:block break-after="page" id="page1">This is content from page 1.</fo:block>
<fo:block break-after="page" id="page2">This is content from page 2.</fo:block>
<fo:block break-after="page" id="page3">This is content from page 3.</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
The xf:afp-tagging element must be a direct child of fo:root and acts as a container for the AFP tags.
For each AFP-tag 3 attributes must be set:
• | ref-id – represents the id of the element (from page-sequence) which will be tagged |
• | key – represents an indexing key. Several elements tagged with the same value for the key attribute can be grouped together |
• | value – represents the value assigned to one specific tag |
Another method to tag a page group is to tag the page sequence directly, as shown in the next example:
<?xml version="1.0" encoding="utf-8" ?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xf="http://www.ecrion.com/xf/1.0" xmlns:xc="http://www.ecrion.com/2008/xc" xmlns:svg="http://www.w3.org/2000/svg">
<xf:afp-tagging>
<xf:afp-tag ref-id="seq1" key="name1" value="value1"/>
<xf:afp-tag ref-id="seq2" key="name2" value="value2"/>
<xf:afp-tag ref-id="seq2" key="name3" value="value3"/>
</xf:afp-tagging>
<fo:layout-master-set>
<fo:simple-page-master master-name="Letter Page" page-width="8.500in" page-height="11.000in">
<fo:region-body region-name="xsl-region-body" margin="0.700in" />
<fo:region-before region-name="xsl-region-before" display-align="after" extent="0.700in"/>
<fo:region-after region-name="xsl-region-after" display-align="before" extent="0.700in"/>
<fo:region-start region-name="xsl-region-start" extent="0.700in"/>
<fo:region-end region-name="xsl-region-end" extent="0.700in"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="Letter Page" id="seq1">
<fo:flow flow-name="xsl-region-body" font-family="Times" font-size="12pt">
<fo:block break-after="page">This are pages from the first page sequence.</fo:block>
<fo:block break-after="page">This are pages from the first page sequence.</fo:block>
<fo:block break-after="page">This are pages from the first page sequence.</fo:block>
</fo:flow>
</fo:page-sequence>
<fo:page-sequence master-reference="Letter Page" id="seq2">
<fo:flow flow-name="xsl-region-body" font-family="Times" font-size="12pt">
<fo:block break-after="page">This are pages from the second page sequence.</fo:block>
<fo:block break-after="page">This are pages from the second page sequence.</fo:block>
<fo:block break-after="page">This are pages from the second page sequence.</fo:block>
</fo:flow>
</fo:page-sequence>
<fo:page-sequence master-reference="Letter Page" id="seq3">
<fo:flow flow-name="xsl-region-body" font-family="Times" font-size="12pt">
<fo:block break-after="page">This are pages from the third page sequence.</fo:block>
<fo:block break-after="page">This are pages from the third page sequence.</fo:block>
<fo:block break-after="page">This are pages from the third page sequence.</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
Dynamic values can also be passed as value for the AFP-tag element.
It is not enough to just specify the ref-id to a block containing dynamic fields. Blocks are used to generate visual output in the template, not for transmitting metadata.
The correct way to do this is by using XSL elements, like the following:
<xf:afp-tag ref-id="page1" key="owner"><xsl:attribute name="value"><xsl:value-of select="/ns:catalog/@owner"/></xsl:attribute></xf:afp-tag>
<xf:afp-tag ref-id="page2" key="title"><xsl:attribute name="value"><xsl:value-of select="/ns:catalog/@title"/></xsl:attribute></xf:afp-tag>
Note:
• | The user can assign only one value per tag. |
AFP Indexing
This can be achieved when the xf:index-document attribute has the value set to "true". When the user will "index" the afp document, the server will output a ZIP archive instead of an AFP file. The ZIP archive will contain two files: out.afp (the output file) and out.ind (the index file). The index is a MODCA file that contains useful information regarding the tagged pages and page-sequences in the document. Such information may include the start offset (in bytes), the extended length (in bytes), the number of the preceding pages etc., of the tagged page.
Usage:
<xf:afp-tagging index-document="true">
<xf:afp-tag ref-id="seq1" key="name1" value="value1"/>
<xf:afp-tag ref-id="seq2" key="name2" value="value2"/>
<xf:afp-tag ref-id="seq2" key="name3" value="value3"/>
</xf:afp-tagging>
AFP Metadata
Another extension used for .afp output files is xf:afp-nop, which must be applied to the fo:page-sequence element. The contents of this section are visible only by AFP viewers as metadata, which appears at the beginning of every page. The AFP NOP contents are not visible when viewing the page nor when printing. NOP data's intended usage is to store additional information about page groups.
To set the encoding for the NOP data, the following encodings are supported: "ASCII", "EBCDIC", "UTF-16".
The following example illustrates the syntax for xf:afp-nop:
<?xml version="1.0" encoding="utf-8" ?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xf="http://www.ecrion.com/xf/1.0">
<fo:layout-master-set>
...
</fo:layout-master-set>
<fo:page-sequence master-reference="default-sequence">
<xf:afp-nop encoding="ASCII">
This text will be seen only by printer and in the .afp file.
</xf:afp-nop>
...
</fo:page-sequence>
</fo:root>