How to insert static text to the last page of sequence?

Here should go questions about transforming XML with XSLT and FOP.
tatra603
Posts: 76
Joined: Fri Sep 17, 2004 10:53 am
Location: Prague, the Czech Republic, Europe

How to insert static text to the last page of sequence?

Post by tatra603 »

Hello!

I am using Apache FOP 0.95 and I have a problem how to insert some static text to the last page of page sequence. In case of multiple pages document, it works OK. But in case of single page document, FOP says, that the only one page is ANY page and not the LAST page. The same logic with the FIRST page works OK. I guess, that more specific (better matching) position should be taken as with the higher precedence. Can You help me, please?

Thank You in advance, Stepan

Code: Select all


<?xml version="1.0" encoding="utf-8"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master master-name="lastPage" page-height="29.7cm" page-width="21.0cm" margin="2cm">
<fo:region-body margin="2cm" />
<fo:region-before extent="2cm" />
<fo:region-after region-name="lastPage" extent="2cm" />
</fo:simple-page-master>
<fo:simple-page-master master-name="firstPage" page-height="29.7cm" page-width="21.0cm" margin="2cm">
<fo:region-body margin="2cm" />
<fo:region-before extent="2cm" />
<fo:region-after region-name="firstPage" extent="2cm" />
</fo:simple-page-master>
<fo:simple-page-master master-name="anyPage" page-height="29.7cm" page-width="21.0cm" margin="2cm">
<fo:region-body margin="2cm" />
<fo:region-before extent="2cm" />
<fo:region-after region-name="anyPage" extent="2cm" />
</fo:simple-page-master>
<fo:page-sequence-master master-name="chapter">
<fo:repeatable-page-master-alternatives>
<!-- to try it, just switch between commenting line 23 and 25 -->
<!-- page-position="last" does NOT works as I want. -->
<!--<fo:conditional-page-master-reference page-position="last" master-reference="lastPage"/>-->
<!-- page-position="first" does works as I want. -->
<fo:conditional-page-master-reference page-position="first" master-reference="firstPage"/>
<fo:conditional-page-master-reference page-position="any" master-reference="anyPage"/>
</fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="chapter">
<fo:static-content flow-name="lastPage">
<fo:block>THIS IS THE LAST PAGE.</fo:block>
</fo:static-content>
<fo:static-content flow-name="firstPage">
<fo:block>THIS IS THE FIRST PAGE.</fo:block>
</fo:static-content>
<fo:static-content flow-name="anyPage">
<fo:block>THIS IS ANY PAGE.</fo:block>
</fo:static-content>
<fo:flow flow-name="xsl-region-body">
<!--<fo:block>Multi page text. It behaves as I want. Add another words to create multi page text.</fo:block>-->
<fo:block>Single page text. It behaves as I do not want.</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
tatra603
Posts: 76
Joined: Fri Sep 17, 2004 10:53 am
Location: Prague, the Czech Republic, Europe

Re: How to insert static text to the last page of sequence?

Post by tatra603 »

Ehm, I want to add this static text to the precise position of the page (xsl-region after left="10pt" top="10pt"), not to the end of flow of xsl-region-body. It should be barcode of inserting machine. Stepan
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: How to insert static text to the last page of sequence?

Post by sorin_ristache »

Hello,

It is a question specific for Apache FOP. I think you can get useful answers from FOP experts on the FOP mailing list.


Regards,
Sorin
Post Reply