Next in thread → Next in month →

Re: [docbook-apps] Adding a Book level TOC to an appendix

From
Bob Stayton <>
Date
2006-11-15T04:35:09+00:00
ID
01da01c7086f$656f3f10$6400a8c0@totoro
Thread
Re: [docbook-apps] Adding a Book level TOC to an appendix
Hi Scott,

Actually, you were pretty close.  Just a 
couple of changes are needed.

 

First, your generate.toc parameter needs to keep 
the "toc" on book but add the others to appendix:

 

<xsl:param name="generate.toc">

book  toc,title

appendix  figure,table

</xsl:param>

 

That's because the find.path.params finds the 
values for the current element, which is appendix. If you use this parameter, 
then $toc.params will have the value "figure,table" in your match="appendix" 
template.

 

Then your code in the match="appendix" template 
just has to adjust the XPath selections to get above the current 
context.  You had this:

 

    <xsl:if test="contains($toc.params, 'figure') and 
.//figure"> 
        
 <xsl:call-template name="list.of.titles">
    
      <xsl:with-param name="titles" 
select="'figure'"/>
          
<xsl:with-param name="nodes" select=".//figure"/> 
    
     </xsl:call-template>
    
</xsl:if>

The XPath .//figure in the first and fourth lines 
finds all figures relative to the context node, which in this case is the 
appendix.  What you want is //figure (no leading dot), which will find all 
figures starting at the root node of the document.  Be sure to change both 
lines.  Then it should work.

 

Bob Stayton
Sagehill Enterprises
DocBook Consulting


 

 

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

  
From: 
  Scott 
  MacGregor 

  
To:  
  

  
Sent: Monday, November 13, 2006 10:52 
  AM

  
Subject: [docbook-apps] Adding a Book 
  level TOC to an appendix

  

I've been really looking around and I cant seem to figure out 
  how to publish a higher level of table of contents into a lower 
  toc-context.

The goal is to move the Book level Table of Figures, or 
  Book level Table of Tables or Book Level Table of Examples into an Appendix. 
  

Modifing the basic params will NOT do this..
example.. It generates 
  a toc of existing items in the Appendix itself..

<xsl:param 
  name="generate.toc" select="'appendix toc'">

Somewhere I need to 
  modify a xsl template 

I was looking at the html\component.xsl 
  

<xsl:template match="appendix">
   <!-- Test Mod 
  here -->

    <xsl:if test="contains($toc.params, 
  'figure') and .//figure"> 
        
   <xsl:call-template name="list.of.titles">
    
        <xsl:with-param name="titles" 
  select="'figure'"/>
          
  <xsl:with-param name="nodes" select=".//figure"/> 
    
       </xsl:call-template>
    
  </xsl:if>

I think the toc-context variable may be adjust the 
  tree level but I am still new at xsl processing.

Can you call something 
  like parent::book ? 

<xsl:param name="toc-context" select="."/> 
  

Please Help..
Next in thread → Next in month →