OK, I think the problem here is that in some cases you want an odd-numbered page to
put the page number on the left, and in other cases on the right, depending on the
preceding page count. I don't see how to do that in XSL-FO.
The footer.content template in fo/pagesetup.xsl has this choice (simplified
somewhat):
<xsl:when $sequence = 'odd' and $position='right'">
<fo:page-number/>
</xsl:when>
Here 'odd' is the number of the current page, and 'right' is the footer location on
the current page. You could change this statement from 'right' to 'left' and it would
work for your current book, but not for others.
XSL-FO does not have the concept of 'right' and 'left' *pages*. It only keeps track
of page numbers, and those numbers can be even or odd. How those odd and even pages
are assembled into a book of left and right spreads is outside the scope of XSL-FO.
I think it operates under the convention that is common in the publishing industry
that when you produce a left-to-right reading document that the first page has the
binding on the left and is numbered 1, making it the right-hand page in the spread
with the page number on the right. Only when you have a right-to-left reading
document such as Hebrew or Arabic is that reversed, but then so is everything else.
Bob Stayton
Sagehill Enterprises
[email protected]
----- Original Message -----
From: "Ivan Ristic" <[email protected]>
To: "Bob Stayton" <[email protected]>
Cc: <[email protected]>
Sent: Wednesday, March 03, 2010 12:08 AM
Subject: Re: [docbook-apps] Footer odd/even page problem when chapters do not begin on
an odd page
On Wed, Mar 3, 2010 at 12:06 AM, Bob Stayton <[email protected]> wrote:
Hi,
I'm not quite clear on this problem. You said:
- My book has parts and my first part falls on an odd page (left).
In my experience, odd pages are right-hand pages, so I don't understand what
you mean here.
Hmm, sorry, I messed up the explanation.
I think you mean that your first part falls on a left-hand page, and you
want it to be numbered with "1", with the first right-hand page after that
numbered as "2", and so forth. Is that right?
That's exactly right, although the issue is not with the numbering:
the left-hand page is numbered with "1" and the right-hand page is
numbered with "2" already.
The issue is that the footer layout is reversed.
Bob Stayton
Sagehill Enterprises
[email protected]
----- Original Message ----- From: "Ivan Ristic" <[email protected]>
To: "Bob Stayton" <[email protected]>
Cc: <[email protected]>
Sent: Monday, March 01, 2010 3:56 AM
Subject: Re: [docbook-apps] Footer odd/even page problem when chapters do
not begin on an odd page
On Sat, Feb 27, 2010 at 12:29 AM, Bob Stayton <[email protected]> wrote:
Hi,
Hi Bob,
Many thanks for your help.
Did you customize the page-sequence-masters as well?
No, I did not -- my knowledge of the stylesheets is limited and I
didn't know what to try next.
With the customisation, per your advice, I managed to have chapters on
auto and the footers rendered correctly.
When I attempted to do the same for all book parts, however, I
encountered another problem:
- My book has parts and my first part falls on an odd page (left).
- The first part is just a single page, and the second page in the
book is the first page of the first chapter. It falls on an even page
(right).
- The initial.page.number template will return 1 for the first page of
the first part because it's the first page of the book (the front
matter uses roman numerals)
- The footer of the second page (even) will be rendered using the odd
layout. (And, from then on, all the pages will have the footer layouts
reversed.)
I hope that was clear, but I'll be happy to send you the PDF extract
or generate a standalone example that replicated the problem.
I've found that if I override the initial.page.number template to
return 'auto' for parts, the footers get rendered correctly (but the
numbering is not reset, of course).
It looks as if the assumption somewhere is that the first book page
will always be on an odd page. Is that correct?
The default in
fo/pagesetup.xsl for body page sequences uses:
<fo:page-sequence-master master-name="body">
<fo:repeatable-page-master-alternatives>
<fo:conditional-page-master-reference master-reference="blank"
blank-or-not-blank="blank"/>
<fo:conditional-page-master-reference master-reference="body-first"
page-position="first"/>
<fo:conditional-page-master-reference master-reference="body-odd"
odd-or-even="odd"/>
<fo:conditional-page-master-reference
odd-or-even="even">
<xsl:attribute name="master-reference">
<xsl:choose>
<xsl:when test="$double.sided != 0">body-even</xsl:when>
<xsl:otherwise>body-odd</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
</fo:conditional-page-master-reference>
</fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>
You should customize it to remove the reference to "body-first" when
page-position="first", because it will be applied to any first page,
regardless of page number.
Bob Stayton
Sagehill Enterprises
[email protected]
----- Original Message ----- From: "Ivan Ristic" <[email protected]>
To: <[email protected]>
Sent: Wednesday, February 24, 2010 3:23 PM
Subject: [docbook-apps] Footer odd/even page problem when chapters do not
begin on an odd page
Hi everyone,
I have written a customisation layer for a book written in DocBook 5
and I've encountered one problem that I can't solve. I think the issue
is with the stylesheets. I am converting the book into PDF. I am using
the 1.74.0 ns stylesheets, but I've verified that the same problem
occurs with the latest version.
In my book I don't want the chapters to begin on odd pages, so I've
added the appropriate styling to avoid blank pages (as well as the
styling to fix the page numbering).
My book is double sided with asymmetric footers. On an odd page, the
page number is on the right. On an even page, the page number is on
the left.
However, when a chapter begins on an even page, the footer is
rendered as if it were on an odd page. After looking at the stylesheet
code, it seems to me that the problem is with the the "sequence"
parameter (to footer.content), which can contain "odd", "even" or
"first". The default stylesheet seems to assume an odd page when the
value is "first". Hence the problem.
Is there some other way to find out if a page number is odd?
Thanks.
--
Ivan Ristic
ModSecurity Handbook [https://www.feistyduck.com]
SSL Labs [https://www.ssllabs.com/ssldb/]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
--
Ivan Ristic
ModSecurity Handbook [http://www.modsecurityhandbook.com]
SSL Labs [https://www.ssllabs.com/ssldb/]
--
Ivan Ristic
ModSecurity Handbook [http://www.modsecurityhandbook.com]
SSL Labs [https://www.ssllabs.com/ssldb/]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]