FOP first page without page number

762 Views Asked by At

I have the xsl-fo template:

<xsl:template match="/">
        <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
            <fo:layout-master-set>
                <fo:simple-page-master margin-right="1cm"
                    margin-left="2.7cm" margin-bottom="2cm" margin-top="2cm"
                    page-width="21.5cm" page-height="29.7cm" master-name="first">
                    <fo:region-body margin-right="1cm" margin-left="0cm" />
                    <fo:region-after region-name="xsl-region-after" display-align="before" extent="0.7in"/>
                </fo:simple-page-master>
            </fo:layout-master-set>

            <fo:page-sequence master-reference="first">
                <fo:static-content flow-name="xsl-region-after">
                    <fo:block text-align="center" font-size="10pt">   
                        <fo:page-number />
                    </fo:block>
               </fo:static-content>
                <fo:flow flow-name="xsl-region-body">
                    <xsl:apply-templates select="rootElement" />
                </fo:flow>
            </fo:page-sequence>
        </fo:root>
    </xsl:template>

All works excellent, but first page have a page number. I do not need number on first page. Thanks y'all!

1

There are 1 best solutions below

0
On

You have to create a separate page-sequence-master for the first page, that does not include the page number. Then use a statement like this to specify which master will be used for each page of the book:

    <fo:page-sequence-master master-name="chapter">
                <fo:repeatable-page-master-alternatives>
                    <fo:conditional-page-master-reference master-reference="page_first" page-position="first"/>
                    <fo:conditional-page-master-reference master-reference="page_even" odd-or-even="even"/>
                    <fo:conditional-page-master-reference master-reference="page_odd" odd-or-even="odd"/>
                </fo:repeatable-page-master-alternatives>
            </fo:page-sequence-master>

(copied from one of my projects, so you'll have to adapt it to your structure)