Insert Document

Top Previous Topic Next Topic  Print this topic

xf:insert-document is an extension used to insert an external document between two fo:page-sequence elements; it can be applied only to fo:root.

 

The following example inserts CoverPage.pdf at the beginning of the document:

 

 

<?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"> (1)

       <fo:layout-master-set>

               <fo:simple-page-master master-name="all-pages" page-width="8.5in" page-height="11in">

                       <fo:region-body region-name="xsl-region-body" column-gap="0.25in" padding="6pt"  padding-bottom="6pt" margin="0.7in"/>

                       <fo:region-before region-name="xsl-region-before" display-align="after" extent="0.7in" padding="6pt"/>

                       <fo:region-after region-name="xsl-region-after" display-align="before" extent="0.7in" padding="6pt"/>

               </fo:simple-page-master>

               <fo:page-sequence-master master-name="default-sequence">

                       <fo:repeatable-page-master-reference master-reference="all-pages"/>

               </fo:page-sequence-master>

       </fo:layout-master-set>

       <xf:insert-document src="url(CoverPage.pdf)" /> (2)

       <fo:page-sequence master-reference="default-sequence">

               ...

               <fo:flow flow-name="xsl-region-body" font-size="12pt" font-family="Times New Roman">

                       <fo:block>...</fo:block>

               </fo:flow>

       </fo:page-sequence>

</fo:root>

 

 

Key observations:

 

(1) In order to work with the extension, the corresponding xml namespace must be defined.

(2) The inserted document's source must be specified.