Re: [docbook-apps] Part title in chunks header

From
Bob Stayton <>
Date
2012-06-08T17:07:42+00:00
ID
009b01cd4599$30e04790$6600a8c0@pazu
Thread
Re: [docbook-apps] Part title in chunks header
Hi Paddy,

There is no <marker> element in XHMTL, nor is 
there a <retrieve-marker> element.  Those are part of the XSL-FO 
vocabulary for paginated output.

 

You can put the content you want to generate 
directly in the customized header.navigation template, in the location where you 
currently have <retrieve-marker>.  The context node for when the 
header.navigation template is called is the element being chunked, so you 
will have to select for an ancestor part element to get its title.  
Something like this:

 

<xsl:if 
test="ancestor-or-self::d:part">

  <xsl:apply-templates 
select="ancestor-or-self::d:part" mode="title.markup"/>

  <xsl:text> - 
</xsl:text>

</xsl:if>

 

 

Bob Stayton
Sagehill Enterprises


 

 

  
----- Original Message ----- 

  
From: 
  Paddy O' 
  Connell 

  
To:  
  

  
Sent: Wednesday, June 06, 2012 8:05 
  AM

  
Subject: [docbook-apps] Part title in 
  chunks header

  

Hi,
  
I'm trying to emulate a customisation Bob helped me with, I added the 
  part title from a docbook5 book project to the body pages of the pdf fo output 
  using the "part.titlepage.before.recto" template from 
  the titlepage.templates.xsl added to my custom layer:

  

  

  
    <xsl:template 
  name="part.titlepage.before.recto">
  
        <fo:marker 
  marker-class-name="part.head.marker">
  
            <xsl:apply-templates select="d:title|d:info/d:title" mode="title.mode"/>
  
        </fo:marker>
    </xsl:template>

  

  
and then using this in 
  the header.content template in the pagesetup.xsl 
  file:

  

  

  
<fo:retrieve-marker retrieve-class-name="part.head.marker"
            
                        
    retrieve-position="first-including-carryover"
            
                        
    retrieve-boundary="document"/>

  

  
Which did the job 
  perfectly.

  
---------------------------------

  
I now need to do the 
  same for the xhtml chunks output.

  

  
I've added this to my xhtml chunks custom 
  layer:

  

  

  
    <xsl:template 
  name="part.titlepage.before.recto">
  
        <marker 
  marker-class-name="part.head.marker">
  
            <xsl:apply-templates select="d:title|d:info/d:title" mode="title.mode"/>
  
        </marker>
    </xsl:template>

  

  
And also taken the header.navigation template from 
  the chunk-common.xsl file and made the following customisation, I've also 
  swapped the $row1 and $row2 to allow the chapter title to display before the 
  section title.

  

  

  
    <xsl:template 
  name="header.navigation">
  
        <xsl:param 
  name="prev" select="/d:foo"/>
  
        <xsl:param 
  name="next" select="/d:foo"/>
  
        <xsl:param 
  name="nav.context"/>
  
        
        <xsl:variable 
  name="home" select="/*[1]"/>
  
        <xsl:variable 
  name="up" select="parent::*"/>
  
        
        <xsl:variable 
  name="row1" select="$navig.showtitles != 0"/>
  
        <xsl:variable 
  name="row2" select="count($prev) &gt; 0       
                        
          
  
            or (count($up) &gt; 0    
                        
                  
            
  and generate-id($up) != generate-id($home)           
                        
          
  
            and $navig.showtitles != 0)     
                        
            
            or 
  count($next) &gt; 0"/> 
        <xsl:if 
  test="$suppress.navigation = '0' 
  and $suppress.header.navigation = '0'">
  
            <div 
  class="navheader">
  
                <xsl:if 
  test="$row1 or $row2">
  
                    <table 
  width="100%" summary="Navigation header">
  
                        
  <xsl:if test="$row1">
  
                        
      <tr>
              
                    <th 
  colspan="3" align="center">
  
                        
              <!-- poc alt, switched the $row to enable the 
  chapter title
                
                        
    to show before section title -->
              
                        
  <xsl:choose>
              
                        
      <xsl:when test="count($up) &gt; 0       
                        
        
    
                        
                    and 
  generate-id($up) != generate-id($home)           
                        
    
        
                        
                and $navig.showtitles != 
  0">

  

  

  

              
                        
          <!-- add 
  marker here -->
      
                        
                  <retrieve-marker 
  retrieve-class-name="part.head.marker"
    
                        
                        
  retrieve-position="first-including-carryover"
    
                        
                        
  retrieve-boundary="document"/>
  
                        
                      
  <xsl:text> - </xsl:text>
              
                        
          <!-- end 
  additional header marker -->

  

  

  

              
                        
          <xsl:apply-templates select="$up" 
  mode="object.title.markup"/>
  
                        
                  </xsl:when>
              
                        
      <xsl:otherwise>&#160;</xsl:otherwise>
              
                        
  </xsl:choose>
              
                        
  <!-- end poc alt --> 
              
                    </th>
              
                </tr>
              
            </xsl:if>
              
            
          
                <xsl:if 
  test="$row2">
  
                        
      <tr>
              
                    <td 
  width="20%" align="{$direction.align.start}">
  
                        
              <xsl:if 
  test="count($prev)&gt;0">
  
                        
                  <a 
  accesskey="p">
  
                        
                      
  <xsl:attribute name="href">
  
                        
                        
    <xsl:call-template name="href.target">
  
                        
                        
        <xsl:with-param 
  name="object" select="$prev"/>
  
                        
                        
    </xsl:call-template>
              
                        
          </xsl:attribute>
              
                        
          <xsl:call-template name="navig.content">
  
                        
                        
    <xsl:with-param name="direction" 
  select="'prev'"/>
  
                        
                      
  </xsl:call-template>
              
                        
      </a>
              
                        
  </xsl:if>
              
                        
  <xsl:text>&#160;</xsl:text>
              
                    </td>
              
                    <th 
  width="60%" align="center">
  
                        
              <!-- poc alt, switched the $row to enable the 
  chapter title
                
                        
    to show before section title -->
              
                        
  <xsl:apply-templates select="." 
  mode="object.title.markup"/>
  
                        
              <!-- end poc alt -->
              
                    </th>
              
                    <td 
  width="20%" align="{$direction.align.end}">
  
                        
              <xsl:text>&#160;</xsl:text>
              
                        
  <xsl:if test="count($next)&gt;0">
  
                        
                  <a 
  accesskey="n">
  
                        
                      
  <xsl:attribute name="href">
  
                        
                        
    <xsl:call-template name="href.target">
  
                        
                        
        <xsl:with-param 
  name="object" select="$next"/>
  
                        
                        
    </xsl:call-template>
              
                        
          </xsl:attribute>
              
                        
          <xsl:call-template name="navig.content">
  
                        
                        
    <xsl:with-param name="direction" 
  select="'next'"/>
  
                        
                      
  </xsl:call-template>
              
                        
      </a>
              
                        
  </xsl:if>
              
                    </td>
              
                </tr>
              
            </xsl:if>
              
        </table>
              
    </xsl:if>
              
    <xsl:if test="$header.rule != 0">
  
                    <hr/>
              
    </xsl:if>
            
  </div>
        </xsl:if>
    </xsl:template>

  

  
I'm getting the additional " - " text but no sign of the part 
  title before it, I'm sure I'm missing something fundamental due to my beginner 
  status, can anyone point me in the right 
  direction.

  

  

  

  

  
---------------------------

  
Best Regards

  
Paddy O' Connell

  
Fife Design 
  Partnership

  
01334 828393

  
www.fifedesign.co.uk