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: Part titlepage customization – ID ref


I have created an extensive customization of the part titlepage that gives choices for changing the order of the part toc and partintro, and whether they occur on the title page recto or verso.

I noticed that when the toc appears on the part titlepage verso, the page number generated in the book toc was where the toc appeared – so it would be an even page number, whereas it should be the page where the title is (i.e. the first page of the titlepage. The ID attribute that generates the page numbers is by default applied to the coding that generates the toc. But if someone wants the toc to appear on the verso, the page number in the book toc will be incorrect. So I had to move the fo: block containing the ID to be applied to the *title* for those options (highlighted in the following). Is this a customization that should be in the standard stylesheets?
-----

 

  <!--Part title and TOC position -
  set to "1" for title-toc-part intro (all on recto),
  set to "2" for title-part intro-toc (all on recto),
  set to "3" for title-toc (both on recto)-part intro (verso),
  set to "4" for title-part intro (both on recto)-toc (verso),
  set to "5" for part title (recto)-toc-part intro (both on verso),
  set to "6" for part title (recto)-part intro-toc (both on verso):-->
   
<xsl:variable name="parttocorder" xml:id="p5-201">1</xsl:variable>

 

 

<!--Add TOC to part titlepage 8/10/12:-->
 
<xsl:template name="part.titlepage.before.verso" priority="1">
   
<xsl:variable name="toc.params">
     
<xsl:call-template name="find.path.params">
       
<xsl:with-param name="table"
          select="normalize-space($generate.toc)"/>
     
</xsl:call-template>
   
</xsl:variable>
   
<!--<xsl:choose><!-\-1,2,3 only required here:-\->
      <xsl:when test="$parttocorder = '1' or $parttocorder = '2'
        or $parttocorder = '3' or $parttocorder = '4' or $parttocorder = '5' or $parttocorder = '6'">-->
       
<xsl:if test="contains($toc.params, 'toc')">
         
<xsl:call-template name="division.toc">
           
<xsl:with-param name="toc.context" select="."/>
         
</xsl:call-template>
       
</xsl:if>   
     
<!--</xsl:when>
     <xsl:otherwise/>
    </xsl:choose>-->
 
</xsl:template>

 
<!--<xsl:template name="part.titlepage.verso" priority="1"><!-\-need this to generate part toc 7/12/12-\->
    <xsl:variable name="toc.params">
      <xsl:call-template name="find.path.params">
        <xsl:with-param name="table"
          select="normalize-space($generate.toc)"/>
      </xsl:call-template>
    </xsl:variable>
    <xsl:choose>
      <!-\-toc on verso - OK -\->
      <xsl:when test="$parttocorder = '4'"><!-\-partpageposition-\->
        <xsl:if test="contains($toc.params, 'toc')">
          <xsl:call-template name="division.toc">
            <xsl:with-param name="toc.context" select="."/>
          </xsl:call-template>
        </xsl:if>   
      </xsl:when>
      <xsl:otherwise/>
    </xsl:choose>
  </xsl:template>-->

 
<!--Change order of part toc - before or after part content:-->
 
<xsl:template match="d:part" mode="part.titlepage.mode">
   
<!-- done this way to force the context node to be the part -->
   
<xsl:param name="additional.content"/>
   
   
<xsl:variable name="id">
     
<xsl:call-template name="object.id"/>
   
</xsl:variable>
   
   
<xsl:variable name="titlepage-master-reference">
     
<xsl:call-template name="select.pagemaster">
       
<xsl:with-param name="pageclass" select="'titlepage'"/>
     
</xsl:call-template>
   
</xsl:variable>
   
   
<fo:page-sequence hyphenate="{$hyphenate}"
      master-reference="{$titlepage-master-reference}">
     
<xsl:attribute name="language">
       
<xsl:call-template name="l10n.language"/>
     
</xsl:attribute>
     
<xsl:attribute name="format">
       
<xsl:call-template name="page.number.format">
         
<xsl:with-param name="master-reference"
            select="$titlepage-master-reference"/>
       
</xsl:call-template>
     
</xsl:attribute>
     
     
<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:call-template>
     
</xsl:attribute>
     
<xsl:attribute name="hyphenation-push-character-count">
       
<xsl:call-template name="gentext">
         
<xsl:with-param name="key" select="'hyphenation-push-character-count'"/>
       
</xsl:call-template>
     
</xsl:attribute>
     
<xsl:attribute name="hyphenation-remain-character-count">
       
<xsl:call-template name="gentext">
         
<xsl:with-param name="key" select="'hyphenation-remain-character-count'"/>
       
</xsl:call-template>
     
</xsl:attribute>
     
      
<xsl:apply-templates select="." mode="running.head.mode">
       
<xsl:with-param name="master-reference" select="$titlepage-master-reference"/>
     
</xsl:apply-templates>
     
     
<xsl:apply-templates select="." mode="running.foot.mode">
       
<xsl:with-param name="master-reference" select="$titlepage-master-reference"/>
     
</xsl:apply-templates>
     
     
<fo:flow flow-name="xsl-region-body">
       
<xsl:call-template name="set.flow.properties">
         
<xsl:with-param name="element" select="local-name(.)"/>
         
<xsl:with-param name="master-reference"
            select="$titlepage-master-reference"/>
       
</xsl:call-template>
       
       
<!--order of part TOC - OK 16/10/12: ******main edits here*******-->
       
<xsl:choose>
         
<!--OK 16/10/12:-->
         
<xsl:when test="$parttocorder = '1'">
           
<!--<xsl:call-template name="part.titlepage.recto"/>--><!--title-->  
           
<fo:block id="{$id}">
             
<xsl:call-template name="part.titlepage"/><!--toc-->
           
</fo:block>
           
<!--<xsl:call-template name="part.titlepage.recto"/>-->   
           
<xsl:copy-of select="$additional.content"/><!--partintro-->
         
</xsl:when>
         
<!--OK 17/10/12:-->
         
<xsl:when test="$parttocorder = '2'">
           
<xsl:call-template name="part.titlepage.recto"/><!--title-->
           
<xsl:copy-of select="$additional.content"/><!--partintro-->
           
<fo:block id="{$id}">
             
<xsl:call-template name="part.titlepage"/><!--toc-->
           
</fo:block>
           
<!--<xsl:call-template name="part.titlepage.recto"/>-->   
         
</xsl:when>
         
<!--OK 17/10/12:-->
         
<xsl:when test="$parttocorder = '3'">
           
<!--<xsl:call-template name="part.titlepage.recto"/>--><!--title-->  
           
<fo:block id="{$id}">
             
<xsl:call-template name="part.titlepage"/><!--toc-->
           
</fo:block>
           
<fo:block break-after="page"/>
           
<xsl:copy-of select="$additional.content"/><!--partintro-->
           
           
<!--<xsl:call-template name="part.titlepage.recto"/>-->   
           
<!--<xsl:copy-of select="$additional.content"/><!-\-partintro-\->
            <xsl:call-template name="part.titlepage.recto"/><!-\-title-\->
            <xsl:copy-of select="$additional.content"/><!-\-partintro-\->
            <fo:block break-after="page"/>           
            <fo:block id="{$id}">
              <xsl:call-template name="part.titlepage.verso"/><!-\-toc-\->
            </fo:block>-->
         
</xsl:when>
         
         
<xsl:when test="$parttocorder = '4'">
           
<!--toc id moved to part title 7/12/12:-->
           
<fo:block id="{$id}">
           
<xsl:call-template name="part.titlepage.recto"/><!--title-->
            
</fo:block>
           
<xsl:copy-of select="$additional.content"/><!--partintro-->
           
<fo:block break-after="page"/>
           
<!--<fo:block id="{$id}">-->
             
<xsl:call-template name="part.titlepage"/><!--toc-->
           
<!--</fo:block>-->
           
<!--<xsl:call-template name="part.titlepage.recto"/>-->   
         
</xsl:when>
         
         
<xsl:when test="$parttocorder = '5'">
           
<!--toc id moved to part title 7/12/12:-->
           
<fo:block id="{$id}">
             
<xsl:call-template name="part.titlepage.recto"/><!--title-->
           
</fo:block>
           
<fo:block break-after="page"/>
           
<xsl:call-template name="part.titlepage"/><!--toc-->
           
<xsl:copy-of select="$additional.content"/><!--partintro-->
           
<!--<fo:block id="{$id}">-->
           
           
<!--</fo:block>-->
           
<!--<xsl:call-template name="part.titlepage.recto"/>-->   
         
</xsl:when>
         
         
<xsl:when test="$parttocorder = '6'">
           
<!--toc id moved to part title 7/12/12:-->
           
<fo:block id="{$id}">
             
<xsl:call-template name="part.titlepage.recto"/><!--title-->
           
</fo:block>
           
<fo:block break-after="page"/>
           
<xsl:copy-of select="$additional.content"/><!--partintro-->
           
<xsl:call-template name="part.titlepage"/><!--toc-->
           
<!--<fo:block id="{$id}">-->
           
           
<!--</fo:block>-->
           
<!--<xsl:call-template name="part.titlepage.recto"/>-->   
         
</xsl:when>
         
         
<xsl:otherwise>
           
<xsl:call-template name="part.titlepage.recto"/><!--title-->  
           
<fo:block id="{$id}">
             
<xsl:call-template name="part.titlepage"/><!--toc-->
           
</fo:block>
           
<!--<xsl:call-template name="part.titlepage.recto"/>-->   
           
<xsl:copy-of select="$additional.content"/><!--partintro-->
         
</xsl:otherwise>

         
<!--<xsl:otherwise>
            <xsl:call-template name="part.titlepage.recto"/>
            <xsl:copy-of select="$additional.content"/>
            <xsl:choose>
              <xsl:when test="$parttocorder = 2">
                <fo:block break-after="page"/>
                <fo:block id="{$id}">
                  <xsl:call-template name="part.titlepage.verso"/>
                </fo:block>
              </xsl:when>
              <xsl:otherwise>
                <fo:block id="{$id}">
                  <xsl:call-template name="part.titlepage"/>
                </fo:block>               
              </xsl:otherwise>
            </xsl:choose>
          </xsl:otherwise>-->
       
</xsl:choose>
     
</fo:flow>
   
</fo:page-sequence>
 
</xsl:template>

 
<xsl:template name="part.titlepage"><!--also need this for option 2-->
   
<fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format">
     
<xsl:variable name="recto.content">
       
<xsl:call-template name="part.titlepage.before.recto"/>
       
<xsl:if test="$parttocorder = '1' or $parttocorder = '3'"><!--OK for 1 and 3-->
         
<xsl:call-template name="part.titlepage.recto"/> 
       
</xsl:if>
       
<!--exclude duplicate of part title - OK 7/12/12:-->
       
<xsl:if test="$parttocorder = '2' or $parttocorder = '4'"><!--OK for '2'-->
         
<!--<xsl:call-template name="part.titlepage.recto"/>--> 
       
</xsl:if>
       
<!--<xsl:call-template name="part.titlepage.recto"/>-->
     
</xsl:variable>
     
<xsl:variable name="recto.elements.count">
       
<xsl:choose>
         
<xsl:when test="function-available('exsl:node-set')"><xsl:value-of select="count(exsl:node-set($recto.content)/*)"/></xsl:when>
         
<xsl:when test="contains(system-property('xsl:vendor'), 'Apache Software Foundation')">
           
<!--Xalan quirk--><xsl:value-of select="count(exsl:node-set($recto.content)/*)"/></xsl:when>
         
<xsl:otherwise>1</xsl:otherwise>
       
</xsl:choose>
     
</xsl:variable>
     
<xsl:if test="(normalize-space($recto.content) != '') or ($recto.elements.count &gt; 0)">
       
<fo:block><xsl:copy-of select="$recto.content"/></fo:block>
     
</xsl:if>
     
<xsl:variable name="verso.content">
       
<xsl:call-template name="part.titlepage.before.verso"/>
       
<xsl:call-template name="part.titlepage.verso"/>
     
</xsl:variable>
      
<xsl:variable name="verso.elements.count">
       
<xsl:choose>
         
<xsl:when test="function-available('exsl:node-set')"><xsl:value-of select="count(exsl:node-set($verso.content)/*)"/></xsl:when>
         
<xsl:when test="contains(system-property('xsl:vendor'), 'Apache Software Foundation')">
           
<!--Xalan quirk--><xsl:value-of select="count(exsl:node-set($verso.content)/*)"/></xsl:when>
         
<xsl:otherwise>1</xsl:otherwise>
       
</xsl:choose>
     
</xsl:variable>
     
<xsl:if test="(normalize-space($verso.content) != '') or ($verso.elements.count &gt; 0)">
       
<fo:block><xsl:copy-of select="$verso.content"/></fo:block>
     
</xsl:if>
     
<xsl:call-template name="part.titlepage.separator"/>
   
</fo:block>
 
</xsl:template>

<!--Turn off the original part toc page-sequence template 8/10/12,
    all commented 7/12/12 to remove extra page sequence for part toc:-->
 
<xsl:template name="generate.part.toc">
   
<!--<xsl:param name="part" select="."/>
   
    <xsl:variable name="lot-master-reference">
      <xsl:call-template name="select.pagemaster">
        <xsl:with-param name="pageclass" select="'lot'"/>
      </xsl:call-template>
    </xsl:variable>
   
    <xsl:variable name="toc.params">
      <xsl:call-template name="find.path.params">
        <xsl:with-param name="node" select="$part"/>
        <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
      </xsl:call-template>
    </xsl:variable>
   
    <xsl:variable name="nodes" select="d:reference|
      d:preface|
      d:chapter|
      d:appendix|
      d:article|
      d:bibliography|
      d:glossary|
      d:index"/>
   
    <xsl:choose>
      <xsl:when test="$parttocorder = '4' or $parttocorder = '5' or $parttocorder = '6'">
        <xsl:if test="count($nodes) &gt; 0 and contains($toc.params, 'toc')">
          <fo:page-sequence hyphenate="{$hyphenate}"
            master-reference="{$lot-master-reference}">
            <xsl:attribute name="language">
              <xsl:call-template name="l10n.language"/>
            </xsl:attribute>
            <xsl:attribute name="format">
              <xsl:call-template name="page.number.format">
                <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="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:with-param name="key" select="'hyphenation-character'"/>
              </xsl:call-template>
            </xsl:attribute>
            <xsl:attribute name="hyphenation-push-character-count">
              <xsl:call-template name="gentext">
                <xsl:with-param name="key" select="'hyphenation-push-character-count'"/>
              </xsl:call-template>
            </xsl:attribute>
            <xsl:attribute name="hyphenation-remain-character-count">
              <xsl:call-template name="gentext">
                <xsl:with-param name="key" select="'hyphenation-remain-character-count'"/>
              </xsl:call-template>
            </xsl:attribute>
           
            <xsl:apply-templates select="$part" mode="running.head.mode">
              <xsl:with-param name="master-reference" select="$lot-master-reference"/>
            </xsl:apply-templates>
           
            <xsl:apply-templates select="$part" mode="running.foot.mode">
              <xsl:with-param name="master-reference" select="$lot-master-reference"/>
            </xsl:apply-templates>
           
            <fo:flow flow-name="xsl-region-body">
              <xsl:call-template name="set.flow.properties">
                <xsl:with-param name="element" select="local-name(.)"/>
                <xsl:with-param name="master-reference"
                  select="$lot-master-reference"/>
              </xsl:call-template>
             
              <xsl:call-template name="division.toc">
                <xsl:with-param name="toc-context" select="$part"/>
                <xsl:with-param name="toc.title.p"
                  select="contains($toc.params, 'title')"/>
              </xsl:call-template>
             
            </fo:flow>
          </fo:page-sequence>
        </xsl:if>   
      </xsl:when>
      <xsl:otherwise/>
    </xsl:choose>-->
 
</xsl:template>


--
Dave Gardiner



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