I am currently using <fo:page-number/> and <fo:page-number-citation ref-id="lastBlock"/> in a FO document to display the page number and total page count.

The issue I have is that I want to detect if I am on the last page by using an <xsl:if test=""> call but don't know how to do this with the page number and page count I already have.

Is this possible?

No, for various reasons. The most important one is that the processing is done in two passes. The first pass is the XSL transformation. The elements prefixed with xsl: are instructions for the XSLT processor, which generates an intermediate XML document consisting of elements in the FO namespace, commonly prefixed with fo:. The FO elements are not processed by the XSLT processor, therefore FO stuff like page numbers are not available to the XSLT processor. In particular there is no way to check whether something is on the last page during XSLT processing. The second pass is the formatting, done by formatting processors like FOP. At this point, all xsl: elements are already gone, there is no xsl:if available to the FO processor.

There are some possibilities in the XSLFO standard to define
limited special processing for the last rendered page of a page
sequence, unfortunately, they are not yet implemented in FOP.

Why do you think you need such a test?


Reply via email to