This is the mail archive of the
docbook-apps@lists.oasis-open.org
mailing list .
Re: [docbook-apps] Page numbering in pdf output
- From: "Bob Stayton" <bobs at sagehill dot net>
- To: <docbook-apps at lists dot oasis-open dot org>, "Dennis Karasev" <dennis at pochtamt dot ru>
- Date: Mon, 18 Oct 2004 23:15:26 -0700
- Subject: Re: [docbook-apps] Page numbering in pdf output
- References: <20041019004840.GA2096@pochtamt.ru>
Hi Dennis,
There isn't an XSL stylesheet parameter to do what you want, but you can
customize a couple of XSL templates that were designed for the purpose. The
originals for these templates are in fo/pagesetup.xsl, and they contain
<xsl:choose> statements to allow different elements to set the initial page
number and page number format.
For your requirement, they are very simple:
<!-- This template always returns the string '1', which
sets the page number format to 1,2,3,... -->
<xsl:template name="page.number.format">
<xsl:param name="element" select="local-name(.)"/>
<xsl:param name="master-reference" select="''"/>
<xsl:value-of select="'1'"/>
</xsl:template>
<!-- This template always continues the page numbering. -->
<!-- For double-sided output, it also forces chapters
to start on odd-numbered pages -->
<xsl:template name="initial.page.number">
<xsl:param name="element" select="local-name(.)"/>
<xsl:param name="master-reference" select="''"/>
<xsl:choose>
<!-- double-sided output -->
<xsl:when test="$double.sided != 0">auto-odd</xsl:when>
<xsl:otherwise>auto</xsl:otherwise>
</xsl:choose>
</xsl:template>
You just need to add these templates to your stylesheet customization layer.
If you don't know about customization layers, you can learn about them in
this reference:
http://www.sagehill.net/docbookxsl/CustomMethods.html#CustomizationLayer
Bob Stayton
Sagehill Enterprises
DocBook Consulting
bobs@sagehill.net
----- Original Message -----
From: "Dennis Karasev" <dennis@pochtamt.ru>
To: <docbook-apps@lists.oasis-open.org>
Sent: Monday, October 18, 2004 5:48 PM
Subject: [docbook-apps] Page numbering in pdf output
> Hello!
>
> I've just skimmed through the "FO Parameter Reference" at
> http://docbook.sourceforge.net/release/xsl/current/doc/fo/, this lists
> archive, and the stylesheets, of course, but the only place which seemed
> close to be handling my problem did so in regard to dsssl.
>
> What I need is straightforward page numbering: the title page is no. 1,
> the TOC, let's say, no. 2, first page of the first chapter - no. 3 then
> (supposing each of them take exactly 1 page and there are no other
> elemants between them).
>
> If I simply change page number format of front matter pages from roman
> to arabic, then I get two no. 1 pages and so on, since new page sequence
> begins after preface.
>
> I guess, though I may be wrong, "reset-page-numbers" parameter in dsssl
> stylesheets addressed the same question, but I haven't found anything
> alike in xsl stylesheets.
>
> Is there a standard (or any noncomplicated) way to solve such a problem
> (an option, perhaps,that I've missed)? If I didn't read some valuable
> source of information addressing this matter, please let me know as well.
>
> TIA
>
> --
> Dennis
>
>