OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: [docbook] Journal article title pages



[I'm also copying this to the docbook-apps mailing list so it gets into the mail archive there]
 
Sorry, I forgot that there was more to it than that when you are using double.sided output.   Two other changes are needed in that case:
 
- the force.page.count template must also be customized, since it causes each article to end on an even page by default.
 
- the body page master must be customized to turn off the selection of the 'body-first' simple page master when page-position="first", because it will use the right-hand page margins for the first page, even if it is evenly numbered.  This requires defining a new page master without the "first" page, and then customizing the template named "select.user.pagemaster" to select it.
 
So here is a complete customization that does what you need.
 
 
<xsl:template name="user.pagemasters">
 
    <fo:page-sequence-master master-name="body-article">
      <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>
 
</xsl:template>
 
<xsl:template name="select.user.pagemaster">
  <xsl:param name="element"/>
  <xsl:param name="pageclass"/>
  <xsl:param name="default-pagemaster"/>
 
  <!-- by default, return the default. But if you've created your own
       pagemasters in user.pagemasters, you might want to select one here. -->
  <xsl:choose>
    <xsl:when test="$element = 'article'">
      <xsl:value-of select="'body-article"/>
    </xsl:when>
    <xsl:otherwise>
      <xsl:value-of select="$default-pagemaster"/>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>
 
 
 

<xsl:template name="force.page.count">
  <xsl:param name="element" select="local-name(.)"/>
  <xsl:param name="master-reference" select="''"/>
 
  <xsl:choose>
    <xsl:when test="$element = 'article'">auto</xsl:when>
    <!-- double-sided output -->
    <xsl:when test="$double.sided != 0">end-on-even</xsl:when>
    <!-- single-sided output -->
    <xsl:otherwise>no-force</xsl:otherwise>
  </xsl:choose>
</xsl:template>
 
 <!-- from fo/pagesetup.xsl -->
 <xsl:template name="initial.page.number">
   <xsl:param name="element" select="local-name(.)"/>
   <xsl:param name="master-reference" select="''"/>
 
   <!-- Select the first content that the stylesheet places
        after the TOC -->
   <xsl:variable name="first.book.content"
                 select="ancestor::d:book/*[
                           not(self::d:title or
                               self::d:subtitle or
                               self::d:titleabbrev or
                               self::d:bookinfo or
                               self::d:info or
                               self::d:dedication or
                               self::d:preface or
                               self::d:toc or
                               self::d:lot)][1]"/>
   <xsl:choose>
     <!-- double-sided output -->
     <xsl:when test="$double.sided != 0">
       <xsl:choose>
        <!-- customisation to start article on next available page, odd or even: begin -->
        <xsl:when test="$element = 'article'">auto</xsl:when>
        <!-- customisation end -->
         <xsl:when test="$element = 'toc'">auto-odd</xsl:when>
         <xsl:when test="$element = 'book'">1</xsl:when>
         <!-- preface typically continues TOC roman numerals -->
         <!-- Change page.number.format if not -->
         <xsl:when test="$element = 'preface'">auto-odd</xsl:when>
         <xsl:when test="($element = 'dedication' or $element = 'article')
                     and not(preceding::d:chapter
                             or preceding::d:preface
                             or preceding::d:appendix
                             or preceding::d:article
                             or preceding::d:dedication
                             or parent::d:part
                             or parent::d:reference)">1</xsl:when>
         <xsl:when test="generate-id($first.book.content) =
                         generate-id(.)">1</xsl:when>
         <xsl:otherwise>auto-odd</xsl:otherwise>
       </xsl:choose>
     </xsl:when>
 
     <!-- single-sided output -->
     <xsl:otherwise>
       <xsl:choose>
         <xsl:when test="$element = 'toc'">auto</xsl:when>
         <xsl:when test="$element = 'book'">1</xsl:when>
         <xsl:when test="$element = 'preface'">auto</xsl:when>
        <xsl:when test="($element = 'dedication' or $element = 'article') and
                         not(preceding::d:chapter
                             or preceding::d:preface
                             or preceding::d:appendix
                             or preceding::d:article
                             or preceding::d:dedication
                             or parent::d:part
                             or parent::d:reference)">1</xsl:when>
         <xsl:when test="generate-id($first.book.content) =
                         generate-id(.)">1</xsl:when>
         <xsl:otherwise>auto</xsl:otherwise>
       </xsl:choose>
     </xsl:otherwise>
   </xsl:choose>
 </xsl:template>
 

 
Bob Stayton
Sagehill Enterprises
bobs@sagehill.net
 
 
----- Original Message -----
Sent: Friday, September 12, 2008 2:54 AM
Subject: Re: [docbook] Journal article title pages

Bob

Not seeing any effect. I wonder if I misunderstood what I should do:
  1. copy the initial.page.number template (about 60 lines) from fo/pagesetup.xsl to my customisation layer;
  2. insert your <xsl:when> element as the first child of the <xsl:choose> element inside the <xsl:when test="$double.sided != 0"> element.
I take it that the jump to an odd page is governed by the <xsl:otherwise>auto-odd</xsl:otherwise> that is the last child of the double-sided <xsl:choose>; and I infer that execution is following this path, (a) because I'm getting a gutter on the left of odd pages and the right of even pages and (b) because I have this problem to solve in the first place. 

I've attached my customisation layer in case you can spot something else I'm doing that obstructs your solution.

Once more, deeply grateful for your advice

Stephen



2008/9/11 Bob Stayton <bobs@sagehill.net>
Hi,
This documentation describes how to customize the template named initial.page.number to set the starting page number for a page-sequence (each article is a page-sequence). 
 
 
If you add:
 
<xsl:when test="$element = 'article'">auto</xsl:when>
 
then articles should start on the next available page.
 
Bob Stayton
Sagehill Enterprises
bobs@sagehill.net
 
 
----- Original Message -----
Sent: Thursday, September 11, 2008 8:17 AM
Subject: [docbook] Journal article title pages

My journal is a book, its children articles. Articles start by default on recto pages, but recto or verso both work for me; I don't want the blank pages.

What small intervention can I make to allow articles to start on verso pages when available?

Stephen Taylor




[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]