xsl-fo starting page-number

Discussion in 'XML' started by hilz, Feb 11, 2004.

  1. hilz

    hilz Guest

    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
     
    hilz, Feb 11, 2004
    #1
    1. Advertising

  2. hilz

    john farrow Guest

    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


    "hilz" <> wrote in message
    news:...
    > 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
    >
    >
    >
     
    john farrow, Feb 11, 2004
    #2
    1. Advertising

  3. hilz

    hilz Guest

    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


    "john farrow" <> wrote in message
    news:mryWb.23552$...
    > 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
    >
    >
    > "hilz" <> wrote in message
    > news:...
    > > 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
    > >
    > >
    > >

    >
    >
     
    hilz, Feb 12, 2004
    #3
  4. On Wed, 11 Feb 2004 19:36:19 -0500, hilz <> wrote:

    > "john farrow" <> wrote in message
    > news:mryWb.23552$...
    >> 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>

    >
    > 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.


    --
    Paul.

    Logic Squad -- Technical Publishing with XML -- http://logicsquad.net/
     
    Paul A. Hoadley, Feb 12, 2004
    #4
  5. hilz

    hilz Guest


    > 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
     
    hilz, Feb 12, 2004
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    1
    Views:
    3,637
    A. Bolmarcich
    May 27, 2005
  2. Michel
    Replies:
    1
    Views:
    2,948
    Michel
    Oct 17, 2005
  3. Replies:
    1
    Views:
    4,397
  4. mathieu

    Starting with XSL-FO

    mathieu, May 20, 2006, in forum: XML
    Replies:
    2
    Views:
    491
    mathieu
    May 22, 2006
  5. Replies:
    0
    Views:
    536
Loading...

Share This Page