AFP Extensions

Top Previous Topic Next Topic  Print this topic

This section describes the extensions to standard XSL-FO elements which are specific to AFP documents.

 

 

AFP Tagging

 

To tag AFP content, the following extensions are used: xf:afp-tagging and xf:afp-tag.

 

The following example shows you how it can be used to tag pages in AFP:

 

<?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. It acts as a container for the AFP tags.

 

An AFP tag is defined by an xf:afp-tag element. It associates a pair of identifiers to a page or page group in the document. The first identifier in the pair is given by the key attribute, while the second is given by the value attribute. Determining the range of pages is done by referring an element in the document using its id attribute. To reference the element, the ref-id attribute is used. The pages to be tagged will be the pages on which the referred element's areas are spread.

 

Another way to tag a page group is to tag the page sequence directly, as shown in this 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>

 

 

AFP Metadata

 

Another extension used for .afp output files is xf:afp-nop which is contained by fo:page-sequence. 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 is intended to be used to store additional information about page groups.

 

The following example illustrates the syntax for xf:afp-nop:

 

<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>

                       This text will be seen only by printer and in the .afp file.

               </xf:afp-nop>

                 ...

       </fo:page-sequence>

</fo:root>