← Prev in month ← Prev in thread

Incorrect page sequence for TOC/Lot and preface pages withdouble-sided output

From
redlettucemail <>
Date
2011-04-10T08:42:18+00:00
ID
Thread
Incorrect page sequence for TOC/Lot and preface pages withdouble-sided output
X-NONE
  X-NONE
  
   
   
   
   
   
   
   
   
   
   
   
  
  MicrosoftInternetExplorer4
  
   
   
   
   
   
   
   
   
   
   
   
  

  X-NONE
  X-NONE
  
   
   
   
   
   
   
   
   
   
   
   
  
  MicrosoftInternetExplorer4
  
   
   
   
   
   
   
   
   
   
   
   
  

I have used the workaround code below to 
delete
blank pages, and renumber, so that there are no blank pages between the 
Table
of contents and each of the lists of figures, tables and examples. The LOTs 
(and
TOC) all appear on their separate pages, but when I set the document to
double-sided output (which has different inner and outer margins) the LOT 
pages
and the following Preface all appear with margins set up for recto (with a
larger inner margin), and the page number in the footer is in the same 
position
for all pages (it should alternate between left and right for subsequent 
pages).
The output should alternate between recto and verso margins. 

 

The first code below is the workaround to 
delete
blank pages. The second is to specify page numbering on the LOT pages. I 
think
I have narrowed down the problem to the first batch of code in the first
example (by iteratively deleting each part of the code – 1 and 2 – and 
transforming),
but I can’t see how the workaround affects the page sequence for LOTs. 
Thanks
very much.

=========================================

 

<!--Delete blank pages in LOTs
and front matter (both 1 and 2 below are required

  code)-->

  <!--1.
don't force pages to end on even-->

  
<xsl:template name="force.page.count">

    <xsl:param
 name
="element"
 select
=
"local-name(.)"/>

    <xsl:param
 name
=
"master-reference" select="''"/>

    

    
<xsl:choose> 

      <xsl:when
 test
=
"starts-with($master-reference, 

        
'lot')"
>no-force

</xsl:when> 

      <xsl:when
 test
=
"starts-with($master-reference, 

        
'front')">
no-force
</xsl:when>

      <xsl:when
 test
="$element = 
'preface'">
end-on-even</xsl:when> 

      <!--
double-sided output --> 

      <xsl:when
 test
="$double.sided != 
0"
>
end-on-even</xsl:when> <!-- end-on-even 
-->

      <!--
single-sided output --> 

      
<xsl:otherwise>
no-force
</xsl:otherwise> 

    
</xsl:choose> 

  
</xsl:template>

  <!--2.
reset initial page number for deleted blank pages-->

  
<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> 

          

<xsl:when test="starts-with($master-reference, 

            
'lot')"
>auto

</xsl:when> 
<!-- 
OPTIONS: auto, auto-odd -->

          

<xsl:when test="starts-with($master-reference, 

            
'front')">
auto
</xsl:when> 

          

<xsl:when test="$element = 'preface'">auto
</xsl:when> 

          

<xsl:when test="$element = 'toc'">
auto
</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::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>

====================================================

  <!--specify content for 
footer text-->

  
<xsl:template name="footer.content">

    <xsl:param
 name
="pageclass"
 select
="''"/>

    <xsl:param
 name
="sequence"
 select
="''"/>

    <xsl:param
 name
="position"
 select
="''"/>

    <xsl:param
 name
="gentext-key"
 select
="''"/>

    

    
<fo:block>

      <!--
pageclass can be: lot, front, body, back -->

      <!--
sequence can be: odd, even, first, blank -->

      <!--
position can be: left, center, right -->

      
<xsl:choose>

        

<xsl:when test="$pageclass = 'titlepage'">

           

<!--nop;
no footer on title pages--> 

        

</xsl:when>

        

        

<xsl:when test="$pageclass = 'lot' or $pageclass = 'front'">

          

<xsl:choose>

            

            
<!-- if 
double-sided document -->

            

<xsl:when test="$double.sided != 0
and ($sequence = 'odd' or

              
$sequence =
'first')">

              

<xsl:choose>

                

<xsl:when test="$position =
'right'"
>

      
            

<fo:page-number/>    

                

</xsl:when>

              

</xsl:choose>

            

</xsl:when>

            

            

<xsl:when test="$double.sided != 0
and $sequence = 'even'">

              

<xsl:choose>

                

<xsl:when test="$position =
'left'"
>

                  

<fo:page-number/>    

                

</xsl:when>

              

</xsl:choose>

            

</xsl:when>

            
<!-- if 
single-sided document -->

              

<xsl:when test="$double.sided = 0
and $position = 'center'">

                

<fo:page-number/>

              

</xsl:when>

            

            

<xsl:otherwise/> 

          

</xsl:choose>

        

</xsl:when>

        

        

<xsl:when test="$pageclass = 'body' or $pageclass = 'back' or $pageclass

          
= 'index'">

        
<!--
put page number on left for verso pages -->

          

<xsl:choose>

            

<xsl:when test="$double.sided != 0
and $sequence = 'even'

              
and
$position='left'">

              

<fo:page-number/>

            

</xsl:when>

            

            
<!-- 
put page number on right for recto pages -->

            

<xsl:when test="$double.sided != 0
and ($sequence = 'odd' or $sequence = 'first')

              
and
$position='right'">

              

<fo:page-number/>

            

</xsl:when>

            

            
<!-- 
put page number on blank pages -->

            

<xsl:when test="$sequence='blank'">

              

<xsl:choose>

                

<xsl:when test="$double.sided != 0
and $position = 'left'">

                  

<fo:page-number/>

                

</xsl:when>

                

<xsl:when test="$double.sided = 0
and $position = 'center'">

                  

<fo:page-number/>

                

</xsl:when>

                

<xsl:otherwise>

                  
<!-- 
nop -->

                

</xsl:otherwise>

              

</xsl:choose>

            

</xsl:when>

            

            
<!-- if 
single-sided document, put page number in centre
for all pages -->

            

<xsl:when test="$double.sided = 0
and $position='center'">

              

<fo:page-number/>

            

</xsl:when>
        

            

<xsl:otherwise>

              
<!-- 
put nothing in footer -->

            

</xsl:otherwise>

          

</xsl:choose>

        

</xsl:when>

        

</xsl:choose>

    
</fo:block>

  
</xsl:template>

 

Dave Gardiner
← Prev in month ← Prev in thread