]> granicus.if.org Git - docbook-dsssl/commitdiff
Fixed bug #1306070 set with 2 books: wrong page numbering on 2nd book.
authorBob Stayton <bobs@sagehill.net>
Wed, 28 Sep 2005 06:38:19 +0000 (06:38 +0000)
committerBob Stayton <bobs@sagehill.net>
Wed, 28 Sep 2005 06:38:19 +0000 (06:38 +0000)
xsl/fo/pagesetup.xsl

index 8fe5f8dba0c9b03a458af97d61d5c4cd14331a5c..2b053a680cbf3f5b3a116c1a7c84ef962ae25c24 100644 (file)
   <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::book/*[
+                          not(self::title or
+                              self::subtitle or
+                              self::titleabbrev or
+                              self::bookinfo or
+                              self::info or
+                              self::dedication or
+                              self::toc or
+                              self::lot)][1]"/>
   <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>
+       <!-- 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 = 'part' and not(preceding::chapter)
-                        and not(preceding::part)">1</xsl:when>
-        <xsl:when test="($element = 'dedication' or $element = 'article') and
-                        not(preceding::chapter
+        <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:when test="generate-id($first.book.content) =
+                       generate-id(.)">1</xsl:when>
         <xsl:otherwise>auto-odd</xsl:otherwise>
       </xsl:choose>
     </xsl:when>
         <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 = 'part' and not(preceding::chapter)
-                        and not(preceding::part)">1</xsl:when>
-        <xsl:when test="($element = 'dedication' or $element = 'article') and
+       <xsl:when test="($element = 'dedication' or $element = 'article') and
                         not(preceding::chapter
                             or preceding::preface
                             or preceding::appendix
                             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:when test="generate-id($first.book.content) =
+                       generate-id(.)">1</xsl:when>
         <xsl:otherwise>auto</xsl:otherwise>
       </xsl:choose>
     </xsl:otherwise>