Unique on page

Top Previous Topic Next Topic  Print this topic

Sometimes, only the the first block or inline with a specified attribute needs to be displayed on the page.

This can be achieved using the xf:unique-on-page extension.

 

Example of usage:

 

 

<?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:simple-page-master master-name="all-pages" page-width="8.5in" page-height="4in">

                       <fo:region-body region-name="xsl-region-body" margin="0.7in" column-gap="0.25in" 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>

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

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

                       <fo:block>

                               paragraph with

                               <fo:inline><fo:inline xf:unique-on-page="1">inline1 should be unique</fo:inline></fo:inline>

                       </fo:block>

                       <fo:block xf:unique-on-page="1" background-color="red">next block with id 1 should not be here</fo:block>

                       <fo:block xf:unique-on-page="2">

                               id = 2 paragraph with

                               <fo:inline><fo:inline>inline2</fo:inline></fo:inline>

                       </fo:block>

                       <fo:block xf:unique-on-page="2" background-color="red">next block with id 2 should not be here</fo:block>

                       <fo:block><fo:inline xf:unique-on-page="3">inline id = 3 </fo:inline></fo:block>

                       <fo:block><fo:inline xf:unique-on-page="3" background-color="red">inline id = 3 should not be here</fo:inline></fo:block>

               </fo:flow>

       </fo:page-sequence>

</fo:root>

 

 

Output:

 

uniqueonpage