470,864 Members | 1,844 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,864 developers. It's quick & easy.

using <fo:page-number/> in <xsl:if test="">

Hello All,
I am trying to use the returned value of the <fo:page-number>
element/function in my <xsl:if> test condition. But am unsuccessful in
doing so. Is it possible to use it in this fashion with a conversion
or correct syntax? I would like to test the current page number and
see if it is even or odd - and if it is odd I would like to perform
additional steps. I would like to do something like this (assume all
namespaces are set):

<xsl:if test="<fo:page-number/>%2">
<xsl:text> Page </xsl:text> <fo:page-number/>

But of coarse the test condition does not want to deal with an
fo:function return value and I just want to do a Modulo of 2 to
determine if it is even or not.

Any help would be appreciated

Dec 2 '05 #1
3 13688
ok - typo in previous post - sorry :-(
code sample should be:

<xsl:if test="<fo:page-number/>%2">
<xsl:text> Page </xsl:text> <fo:page-number/>

Dec 2 '05 #2
I have been searching for a long time.
Did you ever find out how to test the value of fo:page-number?

I want to test to see if I'm on the last page of a document and then print a different footer.

I've tried everything I could think of and I've read everything I could find that sounded like it might have a solution.

I've been posting this:


I was hoping you could help. I would love to see this in your FAQ's.

I want to test to see if I am on the last page of a document and when I am I want to print a different table in REGION AFTER.
I have tried many variations, no luck yet.

It seems like it should be an easy thing to do with xsl:choose.

Any ideas? Here is one of my attempts.

I am trying to test a field value in the footer area like this:

<xsl:when test="document_end = 'TRUE'">
<fo:block font-size="10pt" font-weight="bold">
<fo:block font-size="10pt" font-weight="bold">
not the last page

I am trying to set the value of the field in the detail line loop
like this:

<xsl:if test="position() = last()">
<xsl:variable name="document_end" select="'TRUE'" />
More detail of what the xml, xsl and pdf look like are here:

All suggestions welcome.
May 16 '06 #3
A working way to create a different footer for the last page of a document with xslt.

In the looping of the detail lines test for the last line and set a marker:

<xsl:when test="position() = last()">
<fo:marker marker-class-name="footer-marker">
<fo:block>LAST PAGE</fo:block>
<fo:marker marker-class-name="footer-marker">

then retrieve the marker in the region-after with this:

<fo:retrieve-marker retrieve-position="last-ending-within-page" retrieve-class-name="footer-marker" />
May 16 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by blupp | last post: by
5 posts views Thread by Roger Leigh | last post: by
reply views Thread by clécio | last post: by
1 post views Thread by Marc Boucher | last post: by
6 posts views Thread by Anthony Smith | last post: by
15 posts views Thread by arnuld | last post: by
4 posts views Thread by Daryl Rubble | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.