]> granicus.if.org Git - docbook-dsssl/commitdiff
Added templates to set initial-page-number and force-page-count
authorBob Stayton <bobs@sagehill.net>
Thu, 2 Sep 2004 04:13:53 +0000 (04:13 +0000)
committerBob Stayton <bobs@sagehill.net>
Thu, 2 Sep 2004 04:13:53 +0000 (04:13 +0000)
for page-sequences so they can be customized.

xsl/fo/biblio.xsl
xsl/fo/component.xsl
xsl/fo/division.xsl
xsl/fo/glossary.xsl
xsl/fo/index.xsl
xsl/fo/pagesetup.xsl
xsl/fo/refentry.xsl
xsl/fo/sections.xsl
xsl/fo/toc.xsl

index fef36bacaf5365689b976a75710126805d370656..8a3c408cd1be6ccbea2481b57a049149e4496cd7 100644 (file)
             <xsl:with-param name="master-reference" select="$master-reference"/>
           </xsl:call-template>
         </xsl:attribute>
-        <xsl:choose>
-          <xsl:when test="$double.sided != 0">
-            <xsl:attribute name="initial-page-number">auto-odd</xsl:attribute>
-            <xsl:attribute name="force-page-count">end-on-even</xsl:attribute>
-          </xsl:when>
-          <xsl:otherwise>
-            <xsl:attribute name="force-page-count">no-force</xsl:attribute>
-          </xsl:otherwise>
-        </xsl:choose>
+        <xsl:attribute name="initial-page-number">
+          <xsl:call-template name="initial.page.number">
+            <xsl:with-param name="master-reference" select="$master-reference"/>
+          </xsl:call-template>
+        </xsl:attribute>
+        <xsl:attribute name="force-page-count">
+          <xsl:call-template name="force.page.count">
+            <xsl:with-param name="master-reference" select="$master-reference"/>
+          </xsl:call-template>
+        </xsl:attribute>
         <xsl:attribute name="hyphenation-character">
           <xsl:call-template name="gentext">
             <xsl:with-param name="key" select="'hyphenation-character'"/>
index df1585f64fe43353e44f09083ce8aad61d425cd9..1ecdd2221c878468ce5f60a5bb8fef32ccd8fd6c 100644 (file)
         <xsl:with-param name="master-reference" select="$master-reference"/>
       </xsl:call-template>
     </xsl:attribute>
-    <xsl:choose>
-      <xsl:when test="not(preceding::chapter
-                          or preceding::preface
-                          or preceding::appendix
-                          or preceding::article
-                          or preceding::dedication
-                          or parent::part
-                          or parent::reference)">
-        <!-- if there is a preceding component or we're in a part, the -->
-        <!-- page numbering will already be adjusted -->
-        <xsl:attribute name="initial-page-number">1</xsl:attribute>
-      </xsl:when>
-      <xsl:when test="$double.sided != 0">
-        <xsl:attribute name="initial-page-number">auto-odd</xsl:attribute>
-      </xsl:when>
-    </xsl:choose>
-
-    <xsl:choose>
-      <xsl:when test="$double.sided != 0">
-        <xsl:attribute name="force-page-count">end-on-even</xsl:attribute>
-      </xsl:when>
-      <xsl:otherwise>
-        <xsl:attribute name="force-page-count">no-force</xsl:attribute>
-      </xsl:otherwise>
-    </xsl:choose>
+
+    <xsl:attribute name="initial-page-number">
+      <xsl:call-template name="initial.page.number">
+        <xsl:with-param name="master-reference" select="$master-reference"/>
+      </xsl:call-template>
+    </xsl:attribute>
+
+    <xsl:attribute name="force-page-count">
+      <xsl:call-template name="force.page.count">
+        <xsl:with-param name="master-reference" select="$master-reference"/>
+      </xsl:call-template>
+    </xsl:attribute>
 
     <xsl:attribute name="hyphenation-character">
       <xsl:call-template name="gentext">
         <xsl:with-param name="master-reference" select="$master-reference"/>
       </xsl:call-template>
     </xsl:attribute>
-    <xsl:choose>
-      <xsl:when test="$double.sided != 0">
-        <xsl:attribute name="initial-page-number">auto-odd</xsl:attribute>
-        <xsl:attribute name="force-page-count">end-on-even</xsl:attribute>
-      </xsl:when>
-      <xsl:otherwise>
-        <xsl:attribute name="force-page-count">no-force</xsl:attribute>
-      </xsl:otherwise>
-    </xsl:choose>
+    <xsl:attribute name="initial-page-number">
+      <xsl:call-template name="initial.page.number">
+        <xsl:with-param name="master-reference" select="$master-reference"/>
+      </xsl:call-template>
+    </xsl:attribute>
+    <xsl:attribute name="force-page-count">
+      <xsl:call-template name="force.page.count">
+        <xsl:with-param name="master-reference" select="$master-reference"/>
+      </xsl:call-template>
+    </xsl:attribute>
     <xsl:attribute name="hyphenation-character">
       <xsl:call-template name="gentext">
         <xsl:with-param name="key" select="'hyphenation-character'"/>
       </xsl:call-template>
     </xsl:attribute>
 
-    <!-- Page numbering for a preface doesn't restart; it continues from the ToC -->
-    <xsl:choose>
-      <xsl:when test="$double.sided != 0">
-        <xsl:attribute name="initial-page-number">auto-odd</xsl:attribute>
-        <xsl:attribute name="force-page-count">end-on-even</xsl:attribute>
-      </xsl:when>
-      <xsl:otherwise>
-        <xsl:attribute name="force-page-count">no-force</xsl:attribute>
-      </xsl:otherwise>
-    </xsl:choose>
+    <xsl:attribute name="initial-page-number">
+      <xsl:call-template name="initial.page.number">
+        <xsl:with-param name="master-reference" select="$master-reference"/>
+      </xsl:call-template>
+    </xsl:attribute>
+
+    <xsl:attribute name="force-page-count">
+      <xsl:call-template name="force.page.count">
+        <xsl:with-param name="master-reference" select="$master-reference"/>
+      </xsl:call-template>
+    </xsl:attribute>
 
     <xsl:attribute name="hyphenation-character">
       <xsl:call-template name="gentext">
         <xsl:with-param name="master-reference" select="$master-reference"/>
       </xsl:call-template>
     </xsl:attribute>
-    <xsl:choose>
-      <xsl:when test="not(preceding::chapter
-                          or preceding::appendix
-                          or preceding::article
-                          or preceding::dedication
-                          or parent::part
-                          or parent::reference)">
-        <!-- if there is a preceding component or we're in a part, the -->
-        <!-- page numbering will already be adjusted -->
-        <xsl:attribute name="initial-page-number">1</xsl:attribute>
-      </xsl:when>
-      <xsl:when test="$double.sided != 0">
-        <xsl:attribute name="initial-page-number">auto-odd</xsl:attribute>
-      </xsl:when>
-    </xsl:choose>
-
-    <xsl:choose>
-      <xsl:when test="$double.sided != 0">
-        <xsl:attribute name="force-page-count">end-on-even</xsl:attribute>
-      </xsl:when>
-      <xsl:otherwise>
-        <xsl:attribute name="force-page-count">no-force</xsl:attribute>
-      </xsl:otherwise>
-    </xsl:choose>
+    <xsl:attribute name="initial-page-number">
+      <xsl:call-template name="initial.page.number">
+        <xsl:with-param name="master-reference" select="$master-reference"/>
+      </xsl:call-template>
+    </xsl:attribute>
+
+    <xsl:attribute name="force-page-count">
+      <xsl:call-template name="force.page.count">
+        <xsl:with-param name="master-reference" select="$master-reference"/>
+      </xsl:call-template>
+    </xsl:attribute>
 
     <xsl:attribute name="hyphenation-character">
       <xsl:call-template name="gentext">
         <xsl:with-param name="master-reference" select="$master-reference"/>
       </xsl:call-template>
     </xsl:attribute>
-    <xsl:choose>
-      <xsl:when test="not(preceding::chapter
-                          or preceding::appendix
-                          or preceding::article
-                          or preceding::dedication
-                          or parent::part
-                          or parent::reference)">
-        <!-- if there is a preceding component or we're in a part, the -->
-        <!-- page numbering will already be adjusted -->
-        <xsl:attribute name="initial-page-number">1</xsl:attribute>
-      </xsl:when>
-      <xsl:when test="$double.sided != 0">
-        <xsl:attribute name="initial-page-number">auto-odd</xsl:attribute>
-      </xsl:when>
-    </xsl:choose>
-
-    <xsl:choose>
-      <xsl:when test="$double.sided != 0">
-        <xsl:attribute name="force-page-count">end-on-even</xsl:attribute>
-      </xsl:when>
-      <xsl:otherwise>
-        <xsl:attribute name="force-page-count">no-force</xsl:attribute>
-      </xsl:otherwise>
-    </xsl:choose>
+    <xsl:attribute name="initial-page-number">
+      <xsl:call-template name="initial.page.number">
+        <xsl:with-param name="master-reference" select="$master-reference"/>
+      </xsl:call-template>
+    </xsl:attribute>
+
+    <xsl:attribute name="force-page-count">
+      <xsl:call-template name="force.page.count">
+        <xsl:with-param name="master-reference" select="$master-reference"/>
+      </xsl:call-template>
+    </xsl:attribute>
 
     <xsl:attribute name="hyphenation-character">
       <xsl:call-template name="gentext">
         <xsl:with-param name="master-reference" select="$master-reference"/>
       </xsl:call-template>
     </xsl:attribute>
-    <xsl:choose>
-      <xsl:when test="not(preceding::chapter
-                          or preceding::preface
-                          or preceding::appendix
-                          or preceding::article
-                          or preceding::dedication
-                          or parent::part
-                          or parent::reference)">
-        <!-- if there is a preceding component or we're in a part, the -->
-        <!-- page numbering will already be adjusted -->
-        <xsl:attribute name="initial-page-number">1</xsl:attribute>
-      </xsl:when>
-      <xsl:when test="$double.sided != 0">
-        <xsl:attribute name="initial-page-number">auto-odd</xsl:attribute>
-      </xsl:when>
-    </xsl:choose>
-
-    <xsl:choose>
-      <xsl:when test="$double.sided != 0">
-        <xsl:attribute name="force-page-count">end-on-even</xsl:attribute>
-      </xsl:when>
-      <xsl:otherwise>
-        <xsl:attribute name="force-page-count">no-force</xsl:attribute>
-      </xsl:otherwise>
-    </xsl:choose>
+    <xsl:attribute name="initial-page-number">
+      <xsl:call-template name="initial.page.number">
+        <xsl:with-param name="master-reference" select="$master-reference"/>
+      </xsl:call-template>
+    </xsl:attribute>
+
+    <xsl:attribute name="force-page-count">
+      <xsl:call-template name="force.page.count">
+        <xsl:with-param name="master-reference" select="$master-reference"/>
+      </xsl:call-template>
+    </xsl:attribute>
 
     <xsl:attribute name="hyphenation-character">
       <xsl:call-template name="gentext">
index cec8f7c83a3af6331c58e89ec2150dd84db40099..354c97b31c5f3a4d4d58a3fcd05080517d5679a3 100644 (file)
                           select="$titlepage-master-reference"/>
         </xsl:call-template>
       </xsl:attribute>
-      <xsl:choose>
-        <xsl:when test="$double.sided != 0">
-          <xsl:attribute name="initial-page-number">auto-odd</xsl:attribute>
-          <xsl:attribute name="force-page-count">end-on-even</xsl:attribute>
-        </xsl:when>
-        <xsl:otherwise>
-          <xsl:attribute name="force-page-count">no-force</xsl:attribute>
-        </xsl:otherwise>
-      </xsl:choose>
+
+      <xsl:attribute name="initial-page-number">
+        <xsl:call-template name="initial.page.number">
+          <xsl:with-param name="master-reference" 
+                          select="$titlepage-master-reference"/>
+        </xsl:call-template>
+      </xsl:attribute>
+
+      <xsl:attribute name="force-page-count">
+        <xsl:call-template name="force.page.count">
+          <xsl:with-param name="master-reference" 
+                          select="$titlepage-master-reference"/>
+        </xsl:call-template>
+      </xsl:attribute>
+
       <xsl:attribute name="hyphenation-character">
         <xsl:call-template name="gentext">
           <xsl:with-param name="key" select="'hyphenation-character'"/>
 
   <xsl:if test="contains($toc.params, 'toc')">
     <fo:page-sequence hyphenate="{$hyphenate}"
-                      format="i"
                       master-reference="{$lot-master-reference}">
       <xsl:attribute name="language">
         <xsl:call-template name="l10n.language"/>
                           select="$lot-master-reference"/>
         </xsl:call-template>
       </xsl:attribute>
-      <xsl:choose>
-        <xsl:when test="$double.sided != 0">
-          <xsl:attribute name="initial-page-number">auto-odd</xsl:attribute>
-          <xsl:attribute name="force-page-count">end-on-even</xsl:attribute>
-        </xsl:when>
-        <xsl:otherwise>
-          <xsl:attribute name="force-page-count">no-force</xsl:attribute>
-        </xsl:otherwise>
-      </xsl:choose>
+      <xsl:attribute name="initial-page-number">
+        <xsl:call-template name="initial.page.number">
+          <xsl:with-param name="master-reference"
+                          select="$lot-master-reference"/>
+        </xsl:call-template>
+      </xsl:attribute>
+      <xsl:attribute name="force-page-count">
+        <xsl:call-template name="force.page.count">
+          <xsl:with-param name="master-reference"
+                          select="$lot-master-reference"/>
+        </xsl:call-template>
+      </xsl:attribute>
 
       <xsl:attribute name="hyphenation-character">
         <xsl:call-template name="gentext">
 
   <xsl:if test="$preamble">
     <fo:page-sequence hyphenate="{$hyphenate}"
-                      master-reference="{$titlepage-master-reference}"
-                      initial-page-number="1">
+                      master-reference="{$titlepage-master-reference}">
       <xsl:attribute name="language">
         <xsl:call-template name="l10n.language"/>
       </xsl:attribute>
                           select="$titlepage-master-reference"/>
         </xsl:call-template>
       </xsl:attribute>
-      <xsl:choose>
-        <xsl:when test="$double.sided != 0">
-          <xsl:attribute name="initial-page-number">auto-odd</xsl:attribute>
-          <xsl:attribute name="force-page-count">end-on-even</xsl:attribute>
-        </xsl:when>
-        <xsl:otherwise>
-          <xsl:attribute name="force-page-count">no-force</xsl:attribute>
-        </xsl:otherwise>
-      </xsl:choose>
+      <xsl:attribute name="initial-page-number">
+        <xsl:call-template name="initial.page.number">
+          <xsl:with-param name="master-reference" 
+                         select="$titlepage-master-reference"/>
+        </xsl:call-template>
+      </xsl:attribute>
+      <xsl:attribute name="force-page-count">
+        <xsl:call-template name="force.page.count">
+          <xsl:with-param name="master-reference" 
+                         select="$titlepage-master-reference"/>
+        </xsl:call-template>
+      </xsl:attribute>
 
       <xsl:attribute name="hyphenation-character">
         <xsl:call-template name="gentext">
 
   <xsl:if test="contains($toc.params, 'toc')">
     <fo:page-sequence hyphenate="{$hyphenate}"
-                      format="i"
                       master-reference="{$lot-master-reference}">
       <xsl:attribute name="language">
         <xsl:call-template name="l10n.language"/>
                           select="$lot-master-reference"/>
         </xsl:call-template>
       </xsl:attribute>
-      <xsl:choose>
-        <xsl:when test="$double.sided != 0">
-          <xsl:attribute name="initial-page-number">auto-odd</xsl:attribute>
-          <xsl:attribute name="force-page-count">end-on-even</xsl:attribute>
-        </xsl:when>
-        <xsl:otherwise>
-          <xsl:attribute name="force-page-count">no-force</xsl:attribute>
-        </xsl:otherwise>
-      </xsl:choose>
+      <xsl:attribute name="initial-page-number">
+        <xsl:call-template name="initial.page.number">
+        <xsl:with-param name="element" select="'toc'"/>
+        <xsl:with-param name="master-reference" 
+                        select="$lot-master-reference"/>
+         </xsl:call-template>
+      </xsl:attribute>
+      <xsl:attribute name="force-page-count">
+        <xsl:call-template name="force.page.count">
+          <xsl:with-param name="master-reference" 
+                         select="$lot-master-reference"/>
+        </xsl:call-template>
+      </xsl:attribute>
 
       <xsl:attribute name="hyphenation-character">
         <xsl:call-template name="gentext">
 
   <xsl:if test="contains($toc.params,'figure') and .//figure">
     <fo:page-sequence hyphenate="{$hyphenate}"
-                      format="i"
                       master-reference="{$lot-master-reference}">
       <xsl:attribute name="language">
         <xsl:call-template name="l10n.language"/>
                           select="$lot-master-reference"/>
         </xsl:call-template>
       </xsl:attribute>
-      <xsl:choose>
-        <xsl:when test="$double.sided != 0">
-          <xsl:attribute name="initial-page-number">auto-odd</xsl:attribute>
-          <xsl:attribute name="force-page-count">end-on-even</xsl:attribute>
-        </xsl:when>
-        <xsl:otherwise>
-          <xsl:attribute name="force-page-count">no-force</xsl:attribute>
-        </xsl:otherwise>
-      </xsl:choose>
+      <xsl:attribute name="initial-page-number">
+        <xsl:call-template name="initial.page.number">
+          <xsl:with-param name="element" select="'toc'"/>
+          <xsl:with-param name="master-reference" 
+                          select="$lot-master-reference"/>
+        </xsl:call-template>
+      </xsl:attribute>
+      <xsl:attribute name="force-page-count">
+        <xsl:call-template name="force.page.count">
+          <xsl:with-param name="master-reference" 
+                          select="$lot-master-reference"/>
+        </xsl:call-template>
+      </xsl:attribute>
 
       <xsl:attribute name="hyphenation-character">
         <xsl:call-template name="gentext">
 
   <xsl:if test="contains($toc.params,'table') and .//table">
     <fo:page-sequence hyphenate="{$hyphenate}"
-                      format="i"
                       master-reference="{$lot-master-reference}">
       <xsl:attribute name="language">
         <xsl:call-template name="l10n.language"/>
                           select="$lot-master-reference"/>
         </xsl:call-template>
       </xsl:attribute>
-      <xsl:choose>
-        <xsl:when test="$double.sided != 0">
-          <xsl:attribute name="initial-page-number">auto-odd</xsl:attribute>
-          <xsl:attribute name="force-page-count">end-on-even</xsl:attribute>
-        </xsl:when>
-        <xsl:otherwise>
-          <xsl:attribute name="force-page-count">no-force</xsl:attribute>
-        </xsl:otherwise>
-      </xsl:choose>
+      <xsl:attribute name="initial-page-number">
+        <xsl:call-template name="initial.page.number">
+        <xsl:with-param name="element" select="'toc'"/>
+        <xsl:with-param name="master-reference" 
+                        select="$lot-master-reference"/>
+         </xsl:call-template>
+      </xsl:attribute>
+      <xsl:attribute name="force-page-count">
+        <xsl:call-template name="force.page.count">
+          <xsl:with-param name="master-reference" 
+                         select="$lot-master-reference"/>
+        </xsl:call-template>
+      </xsl:attribute>
 
       <xsl:attribute name="hyphenation-character">
         <xsl:call-template name="gentext">
 
   <xsl:if test="contains($toc.params,'example') and .//example">
     <fo:page-sequence hyphenate="{$hyphenate}"
-                      format="i"
                       master-reference="{$lot-master-reference}">
       <xsl:attribute name="language">
         <xsl:call-template name="l10n.language"/>
                           select="$lot-master-reference"/>
         </xsl:call-template>
       </xsl:attribute>
-      <xsl:choose>
-        <xsl:when test="$double.sided != 0">
-          <xsl:attribute name="initial-page-number">auto-odd</xsl:attribute>
-          <xsl:attribute name="force-page-count">end-on-even</xsl:attribute>
-        </xsl:when>
-        <xsl:otherwise>
-          <xsl:attribute name="force-page-count">no-force</xsl:attribute>
-        </xsl:otherwise>
-      </xsl:choose>
+      <xsl:attribute name="initial-page-number">
+        <xsl:call-template name="initial.page.number">
+        <xsl:with-param name="element" select="'toc'"/>
+        <xsl:with-param name="master-reference" 
+                        select="$lot-master-reference"/>
+         </xsl:call-template>
+      </xsl:attribute>
+      <xsl:attribute name="force-page-count">
+        <xsl:call-template name="force.page.count">
+          <xsl:with-param name="master-reference" 
+                         select="$lot-master-reference"/>
+        </xsl:call-template>
+      </xsl:attribute>
 
       <xsl:attribute name="hyphenation-character">
         <xsl:call-template name="gentext">
 
   <xsl:if test="contains($toc.params,'equation') and .//equation">
     <fo:page-sequence hyphenate="{$hyphenate}"
-                      format="i"
                       master-reference="{$lot-master-reference}">
       <xsl:attribute name="language">
         <xsl:call-template name="l10n.language"/>
                           select="$lot-master-reference"/>
         </xsl:call-template>
       </xsl:attribute>
-      <xsl:choose>
-        <xsl:when test="$double.sided != 0">
-          <xsl:attribute name="initial-page-number">auto-odd</xsl:attribute>
-          <xsl:attribute name="force-page-count">end-on-even</xsl:attribute>
-        </xsl:when>
-        <xsl:otherwise>
-          <xsl:attribute name="force-page-count">no-force</xsl:attribute>
-        </xsl:otherwise>
-      </xsl:choose>
+      <xsl:attribute name="initial-page-number">
+        <xsl:call-template name="initial.page.number">
+        <xsl:with-param name="element" select="'toc'"/>
+        <xsl:with-param name="master-reference" 
+                        select="$lot-master-reference"/>
+         </xsl:call-template>
+      </xsl:attribute>
+
+      <xsl:attribute name="force-page-count">
+        <xsl:call-template name="force.page.count">
+          <xsl:with-param name="master-reference" 
+                         select="$lot-master-reference"/>
+        </xsl:call-template>
+      </xsl:attribute>
 
       <xsl:attribute name="hyphenation-character">
         <xsl:call-template name="gentext">
 
   <xsl:if test="contains($toc.params,'procedure') and .//procedure">
     <fo:page-sequence hyphenate="{$hyphenate}"
-                      format="i"
                       master-reference="{$lot-master-reference}">
       <xsl:attribute name="language">
         <xsl:call-template name="l10n.language"/>
                           select="$lot-master-reference"/>
         </xsl:call-template>
       </xsl:attribute>
-      <xsl:choose>
-        <xsl:when test="$double.sided != 0">
-          <xsl:attribute name="initial-page-number">auto-odd</xsl:attribute>
-          <xsl:attribute name="force-page-count">end-on-even</xsl:attribute>
-        </xsl:when>
-        <xsl:otherwise>
-          <xsl:attribute name="force-page-count">no-force</xsl:attribute>
-        </xsl:otherwise>
-      </xsl:choose>
+      <xsl:attribute name="initial-page-number">
+        <xsl:call-template name="initial.page.number">
+        <xsl:with-param name="element" select="'toc'"/>
+        <xsl:with-param name="master-reference" 
+                        select="$lot-master-reference"/>
+         </xsl:call-template>
+      </xsl:attribute>
+      <xsl:attribute name="force-page-count">
+        <xsl:call-template name="force.page.count">
+          <xsl:with-param name="master-reference" 
+                         select="$lot-master-reference"/>
+        </xsl:call-template>
+      </xsl:attribute>
 
       <xsl:attribute name="hyphenation-character">
         <xsl:call-template name="gentext">
       </xsl:call-template>
     </xsl:attribute>
 
-    <xsl:choose>
-      <xsl:when test="not(preceding::chapter)
-                      and not(preceding::part)">
-        <!-- if there is a preceding chapter or part, page numbering will already -->
-        <!-- be adjusted, otherwise restart the page numbers -->
-        <xsl:attribute name="initial-page-number">1</xsl:attribute>
-      </xsl:when>
-      <xsl:when test="$double.sided != 0">
-        <xsl:attribute name="initial-page-number">auto-odd</xsl:attribute>
-      </xsl:when>
-    </xsl:choose>
-
-    <xsl:choose>
-      <xsl:when test="$double.sided != 0">
-        <xsl:attribute name="force-page-count">end-on-even</xsl:attribute>
-      </xsl:when>
-      <xsl:otherwise>
-        <xsl:attribute name="force-page-count">no-force</xsl:attribute>
-      </xsl:otherwise>
-    </xsl:choose>
+    <xsl:attribute name="initial-page-number">
+      <xsl:call-template name="initial.page.number">
+        <xsl:with-param name="master-reference" 
+                        select="$titlepage-master-reference"/>
+      </xsl:call-template>
+    </xsl:attribute>
+
+    <xsl:attribute name="force-page-count">
+      <xsl:call-template name="force.page.count">
+        <xsl:with-param name="master-reference" 
+                        select="$titlepage-master-reference"/>
+      </xsl:call-template>
+    </xsl:attribute>
 
     <xsl:attribute name="hyphenation-character">
       <xsl:call-template name="gentext">
                           select="$lot-master-reference"/>
         </xsl:call-template>
       </xsl:attribute>
-      <xsl:choose>
-        <xsl:when test="$double.sided != 0">
-          <xsl:attribute name="initial-page-number">auto-odd</xsl:attribute>
-          <xsl:attribute name="force-page-count">end-on-even</xsl:attribute>
-        </xsl:when>
-        <xsl:otherwise>
-          <xsl:attribute name="force-page-count">no-force</xsl:attribute>
-        </xsl:otherwise>
-      </xsl:choose>
+      <xsl:attribute name="initial-page-number">
+        <xsl:call-template name="initial.page.number">
+          <xsl:with-param name="element" select="'toc'"/>
+          <xsl:with-param name="master-reference" 
+                          select="$lot-master-reference"/>
+         </xsl:call-template>
+      </xsl:attribute>
+      <xsl:attribute name="force-page-count">
+        <xsl:call-template name="force.page.count">
+          <xsl:with-param name="master-reference" 
+                          select="$lot-master-reference"/>
+        </xsl:call-template>
+      </xsl:attribute>
 
       <xsl:attribute name="hyphenation-character">
         <xsl:call-template name="gentext">
index 0be4a3a42f40c748f068223c64876d5c72c25ea3..42d648758d319fb5d6bd5bef0b2f04069f18495a 100644 (file)
       </xsl:call-template>
     </xsl:attribute>
     
-    <xsl:choose>
-      <xsl:when test="$double.sided != 0">
-        <xsl:attribute name="force-page-count">end-on-even</xsl:attribute>
-        <xsl:attribute name="initial-page-number">auto-odd</xsl:attribute>
-      </xsl:when>
-      <xsl:otherwise>
-        <xsl:attribute name="force-page-count">no-force</xsl:attribute>
-      </xsl:otherwise>
-    </xsl:choose>
+    <xsl:attribute name="initial-page-number">
+      <xsl:call-template name="initial.page.number">
+        <xsl:with-param name="master-reference" select="$master-reference"/>
+      </xsl:call-template>
+    </xsl:attribute>
+
+    <xsl:attribute name="force-page-count">
+      <xsl:call-template name="force.page.count">
+        <xsl:with-param name="master-reference" select="$master-reference"/>
+      </xsl:call-template>
+    </xsl:attribute>
 
     <xsl:attribute name="hyphenation-character">
       <xsl:call-template name="gentext">
       </xsl:call-template>
     </xsl:attribute>
 
-    <xsl:choose>
-      <xsl:when test="$double.sided != 0">
-        <xsl:attribute name="force-page-count">end-on-even</xsl:attribute>
-        <xsl:attribute name="initial-page-number">auto-odd</xsl:attribute>
-      </xsl:when>
-      <xsl:otherwise>
-        <xsl:attribute name="force-page-count">no-force</xsl:attribute>
-      </xsl:otherwise>
-    </xsl:choose>
+    <xsl:attribute name="initial-page-number">
+      <xsl:call-template name="initial.page.number">
+        <xsl:with-param name="master-reference" select="$master-reference"/>
+      </xsl:call-template>
+    </xsl:attribute>
+
+    <xsl:attribute name="force-page-count">
+      <xsl:call-template name="force.page.count">
+        <xsl:with-param name="master-reference" select="$master-reference"/>
+      </xsl:call-template>
+    </xsl:attribute>
 
     <xsl:attribute name="hyphenation-character">
       <xsl:call-template name="gentext">
index fa856a0adb70fe3a3129ad39445ac302ac14aa5c..447e69b2735016f186e9d39dd0245150c7836e9c 100644 (file)
       </xsl:call-template>
     </xsl:attribute>
 
-    <xsl:choose>
-      <xsl:when test="$double.sided != 0">
-        <xsl:attribute name="force-page-count">end-on-even</xsl:attribute>
-        <xsl:attribute name="initial-page-number">auto-odd</xsl:attribute>
-      </xsl:when>
-      <xsl:otherwise>
-        <xsl:attribute name="force-page-count">no-force</xsl:attribute>
-      </xsl:otherwise>
-    </xsl:choose>
+    <xsl:attribute name="initial-page-number">
+      <xsl:call-template name="initial.page.number">
+        <xsl:with-param name="master-reference" select="$master-reference"/>
+      </xsl:call-template>
+    </xsl:attribute>
+
+    <xsl:attribute name="force-page-count">
+      <xsl:call-template name="force.page.count">
+        <xsl:with-param name="master-reference" select="$master-reference"/>
+      </xsl:call-template>
+    </xsl:attribute>
 
     <xsl:attribute name="hyphenation-character">
       <xsl:call-template name="gentext">
       </xsl:call-template>
     </xsl:attribute>
 
-    <xsl:choose>
-      <xsl:when test="$double.sided != 0">
-        <xsl:attribute name="force-page-count">end-on-even</xsl:attribute>
-        <xsl:attribute name="initial-page-number">auto-odd</xsl:attribute>
-      </xsl:when>
-      <xsl:otherwise>
-        <xsl:attribute name="force-page-count">no-force</xsl:attribute>
-      </xsl:otherwise>
-    </xsl:choose>
+    <xsl:attribute name="initial-page-number">
+      <xsl:call-template name="initial.page.number">
+        <xsl:with-param name="master-reference" select="$master-reference"/>
+      </xsl:call-template>
+    </xsl:attribute>
+
+    <xsl:attribute name="force-page-count">
+      <xsl:call-template name="force.page.count">
+        <xsl:with-param name="master-reference" select="$master-reference"/>
+      </xsl:call-template>
+    </xsl:attribute>
 
     <xsl:attribute name="hyphenation-character">
       <xsl:call-template name="gentext">
index 9072e47b956ef1aeb19b67ae105ebce819fb328b..01f3bd2ec2d2baee9546c4ee3683202bf75955ca 100644 (file)
   <xsl:param name="master-reference" select="''"/>
 
   <xsl:choose>
-    <xsl:when test="$element = 'toc'">i</xsl:when>
+    <xsl:when test="$element = 'toc' and self::book">i</xsl:when>
     <xsl:when test="$element = 'preface'">i</xsl:when>
     <xsl:when test="$element = 'dedication'">i</xsl:when>
     <xsl:otherwise>1</xsl:otherwise>
   </xsl:choose>
 </xsl:template>
 
+<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">
+      <xsl:choose>
+        <xsl:when test="$element = 'toc'">auto-odd</xsl:when>
+        <xsl:when test="$element = 'book'">1</xsl:when>
+        <xsl:when test="$element = 'preface'">auto-odd</xsl:when>
+        <xsl:when test="$element = 'part' and not(preceding::chapter)
+                        and not(preceding::part)">1</xsl:when>
+        <xsl:when test="($element = 'dedication' or $element = 'article') and
+                        not(preceding::chapter
+                            or preceding::preface
+                            or preceding::appendix
+                            or preceding::article
+                            or preceding::dedication
+                            or parent::part
+                            or parent::reference)">1</xsl:when>
+        <xsl:when test="($element = 'chapter' or $element = 'appendix') and
+                        not(preceding::chapter
+                            or preceding::appendix
+                            or preceding::article
+                            or preceding::dedication
+                            or parent::part
+                            or parent::reference)">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 = 'preface'">auto</xsl:when>
+        <xsl:when test="($element = 'dedication' or $element = 'article') and
+                        not(preceding::chapter
+                            or preceding::preface
+                            or preceding::appendix
+                            or preceding::article
+                            or preceding::dedication
+                            or parent::part
+                            or parent::reference)">1</xsl:when>
+        <xsl:when test="($element = 'chapter' or $element = 'appendix') and
+                        not(preceding::chapter
+                            or preceding::appendix
+                            or preceding::article
+                            or preceding::dedication
+                            or parent::part
+                            or parent::reference)">1</xsl:when>
+        <xsl:otherwise>auto</xsl:otherwise>
+      </xsl:choose>
+    </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>
+    <!-- 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>
+
 <!-- ==================================================================== -->
 
 </xsl:stylesheet>
index 2922099ac68ea0532631421e3b86e9f199d9b04f..cea6b8d3ea4dc1f18558fb729121df965d6933c6 100644 (file)
         </xsl:call-template>
       </xsl:attribute>
 
-      <xsl:choose>
-        <xsl:when test="$double.sided != 0">
-          <xsl:attribute name="force-page-count">end-on-even</xsl:attribute>
-          <xsl:attribute name="initial-page-number">auto-odd</xsl:attribute>
-        </xsl:when>
-        <xsl:otherwise>
-          <xsl:attribute name="force-page-count">no-force</xsl:attribute>
-        </xsl:otherwise>
-      </xsl:choose>
+      <xsl:attribute name="initial-page-number">
+        <xsl:call-template name="initial.page.number">
+          <xsl:with-param name="master-reference" select="$master-reference"/>
+        </xsl:call-template>
+      </xsl:attribute>
+
+      <xsl:attribute name="force-page-count">
+        <xsl:call-template name="force.page.count">
+          <xsl:with-param name="master-reference" select="$master-reference"/>
+        </xsl:call-template>
+      </xsl:attribute>
 
       <xsl:attribute name="hyphenation-character">
         <xsl:call-template name="gentext">
       </xsl:call-template>
     </xsl:attribute>
 
-    <xsl:choose>
-      <xsl:when test="$double.sided != 0">
-        <xsl:attribute name="force-page-count">end-on-even</xsl:attribute>
-        <xsl:attribute name="initial-page-number">auto-odd</xsl:attribute>
-      </xsl:when>
-      <xsl:otherwise>
-        <xsl:attribute name="force-page-count">no-force</xsl:attribute>
-      </xsl:otherwise>
-    </xsl:choose>
+    <xsl:attribute name="initial-page-number">
+      <xsl:call-template name="initial.page.number">
+        <xsl:with-param name="master-reference" select="$master-reference"/>
+      </xsl:call-template>
+    </xsl:attribute>
+
+    <xsl:attribute name="force-page-count">
+      <xsl:call-template name="force.page.count">
+        <xsl:with-param name="master-reference" select="$master-reference"/>
+      </xsl:call-template>
+    </xsl:attribute>
 
     <xsl:attribute name="hyphenation-character">
       <xsl:call-template name="gentext">
           </xsl:call-template>
         </xsl:attribute>
 
-        <xsl:choose>
-          <xsl:when test="$double.sided != 0">
-            <xsl:attribute name="force-page-count">end-on-even</xsl:attribute>
-            <xsl:attribute name="initial-page-number">auto-odd</xsl:attribute>
-          </xsl:when>
-          <xsl:otherwise>
-            <xsl:attribute name="force-page-count">no-force</xsl:attribute>
-          </xsl:otherwise>
-        </xsl:choose>
+        <xsl:attribute name="initial-page-number">
+          <xsl:call-template name="initial.page.number">
+            <xsl:with-param name="master-reference" select="$master-reference"/>
+          </xsl:call-template>
+        </xsl:attribute>
+
+        <xsl:attribute name="force-page-count">
+          <xsl:call-template name="force.page.count">
+            <xsl:with-param name="master-reference" select="$master-reference"/>
+          </xsl:call-template>
+        </xsl:attribute>
 
         <xsl:attribute name="hyphenation-character">
           <xsl:call-template name="gentext">
index 17982fb46913c5ec5d13aec38d5964c71482897e..4977516f8c98c984cc9496064d0ba45ac6a6feeb 100644 (file)
       </xsl:call-template>
     </xsl:attribute>
 
-    <xsl:choose>
-      <xsl:when test="$double.sided != 0">
-        <xsl:attribute name="force-page-count">end-on-even</xsl:attribute>
-        <xsl:attribute name="initial-page-number">auto-odd</xsl:attribute>
-      </xsl:when>
-      <xsl:otherwise>
-        <xsl:attribute name="force-page-count">no-force</xsl:attribute>
-      </xsl:otherwise>
-    </xsl:choose>
+    <xsl:attribute name="initial-page-number">
+      <xsl:call-template name="initial.page.number">
+        <xsl:with-param name="master-reference" select="$master-reference"/>
+      </xsl:call-template>
+    </xsl:attribute>
+
+    <xsl:attribute name="force-page-count">
+      <xsl:call-template name="force.page.count">
+        <xsl:with-param name="master-reference" select="$master-reference"/>
+      </xsl:call-template>
+    </xsl:attribute>
 
     <xsl:attribute name="hyphenation-character">
       <xsl:call-template name="gentext">
       </xsl:call-template>
     </xsl:attribute>
 
-    <xsl:choose>
-      <xsl:when test="$double.sided != 0">
-        <xsl:attribute name="force-page-count">end-on-even</xsl:attribute>
-        <xsl:attribute name="initial-page-number">auto-odd</xsl:attribute>
-      </xsl:when>
-      <xsl:otherwise>
-        <xsl:attribute name="force-page-count">no-force</xsl:attribute>
-      </xsl:otherwise>
-    </xsl:choose>
+    <xsl:attribute name="initial-page-number">
+      <xsl:call-template name="initial.page.number">
+        <xsl:with-param name="master-reference" select="$master-reference"/>
+      </xsl:call-template>
+    </xsl:attribute>
+
+    <xsl:attribute name="force-page-count">
+      <xsl:call-template name="force.page.count">
+        <xsl:with-param name="master-reference" select="$master-reference"/>
+      </xsl:call-template>
+    </xsl:attribute>
 
     <xsl:attribute name="hyphenation-character">
       <xsl:call-template name="gentext">
index 257766fb551d7e585854379d91a41ba659404dd6..8368537b49c66d397289042c9f46d3afbb6e976d 100644 (file)
             </xsl:call-template>
           </xsl:attribute>
 
-          <xsl:choose>
-            <xsl:when test="$double.sided != 0">
-              <xsl:attribute name="force-page-count">end-on-even</xsl:attribute>
-              <xsl:attribute name="initial-page-number">auto-odd</xsl:attribute>
-            </xsl:when>
-            <xsl:otherwise>
-              <xsl:attribute name="force-page-count">no-force</xsl:attribute>
-            </xsl:otherwise>
-          </xsl:choose>
+          <xsl:attribute name="initial-page-number">
+            <xsl:call-template name="initial.page.number">
+              <xsl:with-param name="element" select="'toc'"/>
+              <xsl:with-param name="master-reference" 
+                              select="$master-reference"/>
+            </xsl:call-template>
+          </xsl:attribute>
+
+          <xsl:attribute name="force-page-count">
+            <xsl:call-template name="force.page.count">
+              <xsl:with-param name="master-reference" 
+                             select="$master-reference"/>
+            </xsl:call-template>
+          </xsl:attribute>
 
           <xsl:attribute name="hyphenation-character">
             <xsl:call-template name="gentext">
                               select="$master-reference"/>
             </xsl:call-template>
           </xsl:attribute>
-          <xsl:if test="$double.sided != 0">
-            <xsl:attribute name="initial-page-number">auto-odd</xsl:attribute>
-          </xsl:if>
+
+          <xsl:attribute name="initial-page-number">
+            <xsl:call-template name="initial.page.number">
+              <xsl:with-param name="element" select="'toc'"/>
+              <xsl:with-param name="master-reference" 
+                              select="$master-reference"/>
+            </xsl:call-template>
+          </xsl:attribute>
 
           <xsl:attribute name="hyphenation-character">
             <xsl:call-template name="gentext">