468,532 Members | 1,782 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,532 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/>
</xsl:test>

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 13236
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/>
</xsl:if>

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:

Hello,

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:choose>
<xsl:when test="document_end = 'TRUE'">
<fo:block font-size="10pt" font-weight="bold">
LAST PAGE
</fo:block>
</xsl:when>
<xsl:otherwise>
<fo:block font-size="10pt" font-weight="bold">
not the last page
</fo:block>
</xsl:otherwise>
</xsl:choose>

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'" />
</xsl:if>
More detail of what the xml, xsl and pdf look like are here:
http://www.bangboompow.com/xml/invoice/


All suggestions welcome.
Dennis
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:choose>
<xsl:when test="position() = last()">
<fo:marker marker-class-name="footer-marker">
<fo:block>LAST PAGE</fo:block>
</fo:marker>
</xsl:when>
<xsl:otherwise>
<fo:marker marker-class-name="footer-marker">
<fo:block>Continued...</fo:block>
</fo:marker>
</xsl:otherwise>
</xsl:choose>

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.