This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Consecutive page numbering using XSL:FO-to-PDF


I have written an XSLT stylesheet that uses more than one <fo:page-sequence>
to create front matter, a TOC, and chapters in the target PDF document.  To
try and obtain consecutive page numbers that run from the first page of the
first chapter to the last page of the last chapter, I've used the
initial-page-number property, set to "auto", in each <fo:page-sequence>
element.  The result is a PDF document, nicely formatted into chapters with
left and right pages, that has each chapter's first page starting at 1.

For example:

I call the "static_content" template from within the <fo:page-sequence>
element ...

    <fo:page-sequence master-name="chapter"
                      initial-page-number="auto">
        <xsl:call-template name="static_content" />
        <fo:flow flow-name="xsl-region-body">
            <xsl:apply-templates select="./section" />
        </fo:flow>
    </fo:page-sequence>

and then, within the "static_content" template, I use <fo:page-number /> to
generate the page number ...

    <fo:static-content flow-name="odd_footer">
        <fo:table>
            <fo:table-column column-width="3.5in" />
            <fo:table-column column-width="2.5in" />
            <fo:table-column column-width="1.0in" />
            <fo:table-body font-family="sans-serif"
                           font-size="9pt"
                           font-weight="200">
                <fo:table-row>
                    <fo:table-cell>
                       <fo:block text-align="start">
                           <xsl:value-of select="./sectionTitle" />
                       </fo:block>
                    </fo:table-cell>
                    <fo:table-cell>
                        <fo:block text-align="end">
                            <fo:page-number />
                        </fo:block>
                    </fo:table-cell>
                </fo:table-row>
            </fo:table-body>
        </fo:table>
    </fo:static-content>

Does anyone know what I'm doing wrong or how I can obtain sequential page
numbers when using more than one <fo:page-sequence>?

I'm using FOP version 0.19 for the FO-to-PDF conversion.

Thanks,

Drew Hodge
Technical Writer
(613) 270 3652
drew.hodge@entrust.com
www.entrust.com

Entrust(R)
Securing the Internet

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]