docbook-apps

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

  • 1.  Incorrect page sequence for TOC/Lot and preface pages with double-sided output

    Posted 04-10-2011 08:42
    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.


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





    <xsl:templatename="force.page.count"><xsl:paramname="element"select="local-name(.)"/><xsl:paramname="master-reference"select="''"/><xsl:choose><xsl:whentest="starts-with($master-reference,'lot')">no-force</xsl:when><xsl:whentest="starts-with($master-reference,'front')">no-force</xsl:when><xsl:whentest="$element
    = 'preface'">end-on-even</xsl:when><xsl:whentest="$double.sided !=
    0">end-on-even</xsl:when><xsl:otherwise>no-force</xsl:otherwise></xsl:choose></xsl:template><xsl:templatename="initial.page.number"><xsl:paramname="element"select="local-name(.)"/><xsl:paramname="master-reference"select="''"/><xsl:variablename="first.book.content"select="ancestor::d:book/*[not(self::d:title
    orself::d:subtitle orself::d:titleabbrev orself::d:bookinfo orself::d:info
    orself::d:dedication
    orself::d:preface orself::d:toc orself::d:lot)][1]"/><xsl:choose><xsl:whentest="$double.sided !=
    0"><xsl:choose><xsl:whentest="starts-with($master-reference,'lot')">auto</xsl:when><xsl:whentest="starts-with($master-reference,'front')">auto</xsl:when><xsl:whentest="$element
    = 'preface'">auto</xsl:when><xsl:whentest="$element =
    'toc'">auto</xsl:when><xsl:whentest="$element = 'book'">1</xsl:when><xsl:whentest="$element =
    'preface'">auto-odd</xsl:when><xsl:whentest="($element = 'dedication' or
    $element = 'article')and
    not(preceding::chapteror
    preceding::d:prefaceor
    preceding::d:appendixor
    preceding::d:articleor
    preceding::d:dedicationor
    parent::d:partor
    parent::d:reference)">1</xsl:when><xsl:whentest="generate-id($first.book.content)
    =generate-id(.)">1</xsl:when><xsl:otherwise>auto-odd</xsl:otherwise></xsl:choose></xsl:when><xsl:otherwise><xsl:choose><xsl:whentest="$element =
    'toc'">auto</xsl:when><xsl:whentest="$element =
    'book'">1</xsl:when><xsl:whentest="$element =
    'preface'">auto</xsl:when><xsl:whentest="($element = 'dedication' or
    $element = 'article') andnot(preceding::d:chapteror
    preceding::d:prefaceor
    preceding::d:appendixor
    preceding::d:articleor
    preceding::d:dedicationor
    parent::d:partor
    parent::d:reference)">1</xsl:when><xsl:whentest="generate-id($first.book.content)
    =generate-id(.)">1</xsl:when><xsl:otherwise>auto</xsl:otherwise></xsl:choose></xsl:otherwise></xsl:choose></xsl:template>


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


    <xsl:templatename="footer.content"><xsl:paramname="pageclass"select="''"/><xsl:paramname="sequence"select="''"/><xsl:paramname="position"select="''"/><xsl:paramname="gentext-key"select="''"/><fo:block><xsl:choose><xsl:whentest="$pageclass = 'titlepage'"></xsl:when><xsl:whentest="$pageclass = 'lot' or
    $pageclass = 'front'"><xsl:choose><xsl:whentest="$double.sided != 0
    and ($sequence = 'odd' or$sequence =
    'first')"><xsl:choose><xsl:whentest="$position =
    'right'"><fo:page-number/></xsl:when></xsl:choose></xsl:when><xsl:whentest="$double.sided
    != 0
    and $sequence = 'even'"><xsl:choose><xsl:whentest="$position =
    'left'"><fo:page-number/></xsl:when></xsl:choose></xsl:when><xsl:whentest="$double.sided = 0
    and $position =
    'center'"><fo:page-number/></xsl:when><xsl:otherwise/></xsl:choose></xsl:when><xsl:whentest="$pageclass
    = 'body' or $pageclass = 'back' or $pageclass= 'index'"><xsl:choose><xsl:whentest="$double.sided != 0
    and $sequence = 'even'and
    $position='left'"><fo:page-number/></xsl:when><xsl:whentest="$double.sided != 0
    and ($sequence = 'odd' or $sequence = 'first')and
    $position='right'"><fo:page-number/></xsl:when><xsl:whentest="$sequence='blank'"><xsl:choose><xsl:whentest="$double.sided
    != 0
    and $position =
    'left'"><fo:page-number/></xsl:when><xsl:whentest="$double.sided = 0
    and $position = 'center'"><fo:page-number/></xsl:when><xsl:otherwise></xsl:otherwise></xsl:choose></xsl:when><xsl:whentest="$double.sided = 0
    and $position='center'"><fo:page-number/></xsl:when><xsl:otherwise></xsl:otherwise></xsl:choose></xsl:when></xsl:choose></fo:block></xsl:template>



    Dave Gardiner