Topics

Different footer on single/multipage layouts

Chris Brand
 

Hi XSL-FO experts

 

I have a special DITA PDF-layout (FOP) with no cover page but just first and odd pages. The first page has a simple footer with the page number, and the odd pages show an extended footer with company addresses, etc. This works fine when the content spans over multiple pages. If the content spans only one page, I'd like to show the extended footer directly.

 

Somehow the formatter must be able to check if the content is on one page max, then apply the extended footer. If the content spans over more pages, apply a first page with a simple footer and for all other pages apply the extended footer. Googling around revealed the attribute "maximum-repeats" I can set on <fo:repeatable-page-master-alternatives>. I tried several attempts, but wasn't successful. By the time, I'm completely lost.

 

How to best do this?

 

Thanks, your help is highly appreciated.
Chris.

 

 

 

 

Nicolas Delobel
 

Hi Chris,

Did you try to set @page-position attribute to "only" (see https://www.w3.org/TR/xsl11/#page-position) like following and define a specific <fo:simple-page-master/> for the "lonely" pages:

<fo:page-sequence-master master-name="myMasterPage">
        <fo:repeatable-page-master-alternatives>
          <fo:conditional-page-master-reference master-reference="only-page-layout" page-position="only" />
          <fo:conditional-page-master-reference master-reference="first-page-layout" page-position="first" />
                     ...
        </fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>

Nicolas

Toshihiko Makita
 

Hi Chiris,

> I have a special DITA PDF-layout (FOP) with no cover page but just first and odd pages. The first page has a simple footer with the page number, and the odd pages show an extended footer with company addresses, etc. This works fine when the content spans over multiple pages. If the content spans only one page, I'd like to show the extended footer directly.


One idea is to use fo:marker/fo:retrieve-marker mechanism for your company address in your footer (fo:static-content) if your output is composed of only two pages. 

6.13.5 fo:marker → https://www.w3.org/TR/xsl11/#fo_marker

6.13.6 fo:retrieve-marker → https://www.w3.org/TR/xsl11/#fo_retrieve-marker

At the top of the text flow, locate fo:marker with empty contents.

At the last of the text, locate fo:marker with your company address.

In the footer fo:static-contents, locate fo:retrieve-marker that fetches fo:marker contents. Probably you should adjust the property fo:retrieve-marker/@retrieve-position and @retrieve-boundary to fit with your document condition.

Hope this helps your stylesheet development.

Regards,

-- 
/*--------------------------------------------------

 Toshihiko Makita
 Development Group. Antenna House, Inc. Ina Branch
 Web site:
 http://www.antenna.co.jp/
 http://www.antennahouse.com/
 --------------------------------------------------*/ 

Chris Brand
 

Hi Nicolas

 

Great! page-position="only" was the solution. Had to restructure all the static stuff for the footers but now it works like a charm. Thanks!

 

Greez,

Chris.

 

Von: main@dita-users.groups.io [mailto:main@dita-users.groups.io] Im Auftrag von Nicolas Delobel
Gesendet: Freitag, 29. Mai 2020 15:49
An: main@dita-users.groups.io
Betreff: Re: [dita-users] Different footer on single/multipage layouts

 

Hi Chris,

Did you try to set @page-position attribute to "only" (see https://www.w3.org/TR/xsl11/#page-position) like following and define a specific <fo:simple-page-master/> for the "lonely" pages:

<fo:page-sequence-master master-name="myMasterPage">
        <fo:repeatable-page-master-alternatives>
          <fo:conditional-page-master-reference master-reference="only-page-layout" page-position="only" />
          <fo:conditional-page-master-reference master-reference="first-page-layout" page-position="first" />
                     ...
        </fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>

Nicolas

Chris Brand
 

Hi Toshihiko

 

Thanks as well for this hint. I'm sure this comes handy for another use case I have ...

 

Greez,

Chris.

 

Von: main@dita-users.groups.io [mailto:main@dita-users.groups.io] Im Auftrag von Toshihiko Makita
Gesendet: Freitag, 29. Mai 2020 17:28
An: main@dita-users.groups.io
Betreff: Re: [dita-users] Different footer on single/multipage layouts

 

Hi Chiris,

> I have a special DITA PDF-layout (FOP) with no cover page but just first and odd pages. The first page has a simple footer with the page number, and the odd pages show an extended footer with company addresses, etc. This works fine when the content spans over multiple pages. If the content spans only one page, I'd like to show the extended footer directly.


One idea is to use fo:marker/fo:retrieve-marker mechanism for your company address in your footer (fo:static-content) if your output is composed of only two pages. 

6.13.5 fo:marker → https://www.w3.org/TR/xsl11/#fo_marker

6.13.6 fo:retrieve-marker → https://www.w3.org/TR/xsl11/#fo_retrieve-marker

At the top of the text flow, locate fo:marker with empty contents.

At the last of the text, locate fo:marker with your company address.

In the footer fo:static-contents, locate fo:retrieve-marker that fetches fo:marker contents. Probably you should adjust the property fo:retrieve-marker/@retrieve-position and @retrieve-boundary to fit with your document condition.

Hope this helps your stylesheet development.

Regards,

-- 
/*--------------------------------------------------

 Toshihiko Makita
 Development Group. Antenna House, Inc. Ina Branch
 Web site:
 http://www.antenna.co.jp/
 http://www.antennahouse.com/
 --------------------------------------------------*/