473,761 Members | 5,839 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 14279
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
freefly_xml
2 New Member
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:otherwis e>
<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
freefly_xml
2 New Member
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>LAS T PAGE</fo:block>
</fo:marker>
</xsl:when>
<xsl:otherwis e>
<fo:marker marker-class-name="footer-marker">
<fo:block>Conti nued...</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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
6429
by: blupp | last post by:
Hi, I am trying to install the package, but get the following error: cpan> install Date::Manip Running install for module Date::Manip Running make for S/SB/SBECK/DateManip-5.42a.tar.gz LWP not available Fetching with Net::FTP: ftp://ftp.perl.org/pub/CPAN/authors/id/S/SB/SBECK/DateManip-5.42a.tar.gz
5
2123
by: Roger Leigh | last post by:
I've written a simple container template class to contain a single value. This emits a signal when the value is changed (it's used as a notifier of changes), and listeners can connect to its changed signal. i.e. field<int> i(2); i = 4; // field<int>::m_value = 4; changed signal is emitted. Currently, the contained value may be accessed via get_value() and set_value() methods, and for ease of use, operator= and some type conversions...
0
1155
by: clécio | last post by:
Hi folks! i developed a web custom control inherited from webcontrol, but when i try to bound a property using <%= %>, i have all the code put between de ' ! ex.: <uc1:SkinControlManager WebControl='<%= Me.Attributes("WebControl")%>' runat="server" ID="Skincontrolmanager1"/> anybody can help me!? tks!
1
2397
by: Marc Boucher | last post by:
I'm using PG 7.3.4 I've a table with a column of type int8 where I store date-based values, and an index exists for it. The problem is that the index is almost never used with the '>' test. # explain SELECT date FROM album WHERE (date='1093989600'); Index Scan using date_album_key on album (cost=0.00..86.31 rows=21 width=8) Index Cond: (date = 1093989600::bigint)
6
1985
by: Anthony Smith | last post by:
I can call a class using "->", but it complains about the :: I see on the net where :: is used. Is there a good explanation on when to use one over the other or the differences? $help = new help(); $help->foo(); $help::foo(); class help{
15
2680
by: arnuld | last post by:
-------- PROGRAMME ----------- /* Stroustrup, 5.6 Structures STATEMENT: this programmes *tries* to do do this in 3 parts: 1.) it creates a "struct", named "jd", of type "address". 2. it then adds values to "jd" 3.) in the end it prints values of "jd".
2
2059
by: -Karl | last post by:
Couls someone please advise me on this error. What I am trying to do is be able to convert an XML document into arrays. I read that the subs & functions have to be in <scripttags. Thanks! Error: BC30456: 'Read_DOM' is not a member of
2
2313
by: Sam | last post by:
Recently started using DB_DataObject with a Postgresql DB. Seems pretty nice, but I am not sure if insert() is supposed to be able to return the id of a recently returned object. It just seems to return 1 for me. I'm not really sure if DataObject gets confused because it would like to create the sequences itself which have been created for me automatically because I created the primary keys as serials. Or something like that. Would at...
0
1132
by: bizt | last post by:
Hi, When using the Save() and SaveXML() functions I am able to output xml on a screen or save to file. The only issue is that I would prefer to have it a bit more readable. For example: Current: <?xml... ?><root><person><first_name>Monty</first_name><surname>Burns</ surname></person></root>
4
1284
by: Daryl Rubble | last post by:
I am trying to script a page on my IIS server running PHP, and every time i try to use the <? ?> in the script, it wont load it. Normal Page with NO error <?php echo"this is what is working fine but when i close and reopen the php it causes a error"; ?>
0
9554
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9377
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10136
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9925
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8814
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6640
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5266
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5405
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3509
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.