Search code examples
xslt-2.0xsl-foapache-fop

Multiple fo:retrieve-marker with same name


Two page footers are having same fo:retrieve-marker:- retrieve-class-name , retrieve-boundary & retrieve-position now if I am calling the marker-class-name with a fo:marker from xsl-region-body which footer it will be get retrieved ? And Why?

Below is the sample

<fo:static-content flow-name="second-page-footer" font-family="normal" font-style="normal" font-size="4">
    <fo:retrieve-marker retrieve-class-name="continued" retrieve-position="last-starting-within-page" retrieve-boundary="page"/>
        <fo:block-container position="absolute"  top="20mm">
           <xsl:call-template name="pageTwoFooter"/>
        </fo:block-container>
</fo:static-content>

<fo:static-content flow-name="rest-page-footer" font-family="normal" font-style="normal" font-size="4">
    <fo:retrieve-marker retrieve-class-name="continued" retrieve-position="last-starting-within-page" retrieve-boundary="page"/>
</fo:static-content>



<fo:flow flow-name="xsl-region-body" font-size="8pt" font-family="normal" font-style="normal" font-weight="normal">
   <fo:marker marker-class-name="continued">
           <xsl:call-template name="continuedNextPage"/>
   </fo:marker>
<fo:flow>

Or what will be the correct understanding?


Solution

  • There is some indirection going on here that determines which fo:static-content is used.

    The region-name on each fo:region-* on a fo:simple-page-master differentiates that particular region from the other regions on the page. When an fo:simple-page-master is used to generate a page in a page sequence, if there is an fo:static-content with a flow-name that matches the region-name of one of the regions of the current fo:page-master-sequence, then the content of that fo:static-content is directed into that region of the generated page. Any fo:static-content that does not have a corresponding fo:region-* does nothing for that page.

    An fo:page-sequence-master lets you set up the conditions for selecting between different fo:simple-page-master. The most obvious uses for this are to select a different fo:simple-page-master for the first page generated from an fo:page-sequence than for the rest of the pages or to select different fo:simple-page-master for odd pages than for even pages.

    In your case, you seem to be using a different fo:simple-page-master for the second page in a page sequence than is used for the rest of the pages.

    If the fo:simple-page-master for the second page has <fo:region-after region-name="second-page-footer"/> and the fo:simple-page-master for the rest of the pages has <fo:region-after master-name="rest-page-footer"/>, then when the formatter generates pages for the page sequence, it will use the content of <fo:static-content flow-name="second-page-footer"... on the second page and use the content of <fo:static-content flow-name="rest-page-footer"... on the rest of the pages.

    Please also see the XSL-FO parts of the descriptions in the 'Page Layout' and 'Headers & Footers' chapters of the 'XSL-FO/CSS Comparison' available at https://www.antennahouse.com/xsl-fo-css-comparison