xsl-fo starting page-number

H

hilz

Hi all:
Is there a way to make the <fo:page-number> start from a value
different than 1 ? (using fop to generate pdf)

thanks
hilz
 
J

john farrow

Set the initial-page-number attribute like this:

<?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="page">
<fo:region-body margin='2.5cm' region-name="body"/>
</fo:simple-page-master>
</fo:layout-master-set>

<fo:page-sequence master-reference="page" initial-page-number="19">
<fo:flow flow-name="body">
<fo:block >page number is <fo:page-number/></fo:block>
</fo:flow>
</fo:page-sequence>

</fo:root>

Regards

John Farrow
http://www.xmlpdf.com
 
H

hilz

John,
Thank you so much for the quick answer.
I tired it and it worked great.

Now when i try to substitute the number "19" with a variable
"$initialPageNumber" that i pre-defined, it gives the error below:

javax.xml.transform.TransformerException: org.apache.fop.apps.FOPException:
The value '$initialPageNumber' is not valid for initial-page-number

any idea how i can pass a variable here?
thanks a bunch
hilz
 
P

Paul A. Hoadley

Thank you so much for the quick answer.
I tired it and it worked great.

Now when i try to substitute the number "19" with a variable
"$initialPageNumber" that i pre-defined, it gives the error below:

John's example is straight XSL-FO. Presumably what you're not telling
us is that you are writing an XSLT transform in which you're using a
variable, and presumably you've written something like:

<fo:page-sequence master-reference="page"
initial-page-number="$initialPageNumber">

when what you meant was:

<fo:page-sequence master-reference="page"
initial-page-number="{$initialPageNumber}">

Of course, I'm just guessing because you didn't post any code.
 
H

hilz

John's example is straight XSL-FO. Presumably what you're not telling
us is that you are writing an XSLT transform in which you're using a
variable, and presumably you've written something like:

<fo:page-sequence master-reference="page"
initial-page-number="$initialPageNumber">

when what you meant was:

<fo:page-sequence master-reference="page"
initial-page-number="{$initialPageNumber}">

Of course, I'm just guessing because you didn't post any code.

Paul, thanks for your answer.
Sorry for the ambiguity in my question.Yes I am using XSLT transformation
with an xml file to produce the fo then the pdf.
And your suggestion of placing the variable between {} worked great, thank
you. Another solution was to add it as an attribute element inside the
page-sequence element as below:

<xsl:attribute name="initial-page-number"><xsl:value-of
select="$startingPageNumber"/></xsl:attribute>

Thanks
hilz
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top