Re: [docbook-apps] Adding a PDF bookmark for List of Figures

From
"Cob Rtayton"
Date
2007-09-05T03:35:43+00:00
ID
090401c7ef6d$b95dbb70$6400a8c0@totoro
Thread
Re: [docbook-apps] Adding a PDF bookmark for List of Figures
Hi Jeff,

Well, you aren't selecting the List of Figures, 
because it isn't an element because it is generated.  In fo/fop1.xsl, the 
template that matches on book and other elements has these lines that generate 
the bookmark for the TOC:

 

      <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:if 
test="contains($toc.params, 
'toc')
                    
and 
(book|part|reference|preface|chapter|appendix|article
                         
|glossary|bibliography|index|setindex
                         
|refentry
                         
|sect1|sect2|sect3|sect4|sect5|section)">
        
<fo:bookmark 
internal-destination="toc...{$id}">
          
<fo:bookmark-title>
            
<xsl:call-template 
name="gentext">
              
<xsl:with-param name="key" 
select="'TableofContents'"/>
            
</xsl:call-template>
          
</fo:bookmark-title>
        
</fo:bookmark>
      
</xsl:if>

Copy the xsl:if block and change a few things for a 
list of figures:

 

      <xsl:if 
test="contains($toc.params, 
'figure')
                    
and (//figure)">
        
<fo:bookmark 
internal-destination="toc...figure...{$id}">
          
<fo:bookmark-title>
            
<xsl:call-template 
name="gentext">
              
<xsl:with-param name="key" 
select="'ListofFigures'"/>
            
</xsl:call-template>
          
</fo:bookmark-title>
        
</fo:bookmark>
      
</xsl:if>

I got the $toc.params value from the $generate.toc 
parameter in fo/param.xsl, and changed it to check for the existance of any 
figure in the document.  I got the figure list id from the "list.of.titles" 
template in fo/autotoc.xsl.  That template generates all of the "List of 
..." lists.  I got the gentext key from common/en.xml.

 

Hope this works.  I didn't actually test it, 
so let me know if it does or does not.  8^)

 

Bob Stayton
Sagehill Enterprises
DocBook Consulting


 

 

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

  
From: 
  Jeff 
  Powanda 

  
To: Bob Stayton ;  
  

  
Sent: Tuesday, September 04, 2007 5:48 
  PM

  
Subject: RE: [docbook-apps] Adding a PDF 
  bookmark for List of Figures

  

  

  
I’m using FOP 0.93, 
  so I have to match=”book” and mode=”fop1.outline”. However, I need help on how 
  to select the List of Figures and add a bookmark for it.

  
 

  
Regards,

  
Jeff 
  Powanda

  
 

  

  

  
  

  
From: Bob 
  Stayton [mailto:] 
Sent: Tuesday, September 04, 2007 3:15 
  PM
To: Jeff Powanda; 
Subject: Re: [docbook-apps] Adding a PDF 
  bookmark for List of Figures

  
 

  

  
Hi Jeff,

  

  
The PDF bookmark syntax is 
  specific to each FO processor.  What FO processor are you 
  using?

  

  
 

  

  
In general, you need to find the 
  code that generates the bookmark for the TOC, and do something like it.  
  For example, for XEP, the code is in the template with match="book" and 
  mode="xep.outline" in fo/xep.xsl.

  

  
 

  

  
Bob Stayton
Sagehill Enterprises
DocBook 
  Consulting


  

  
 

  

  
 

  
    

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

    

    
From: Jeff Powanda 
    

    

    
To:  
    

    

    
Sent: 
    Tuesday, September 04, 2007 2:39 PM

    

    
Subject: 
    [docbook-apps] Adding a PDF bookmark for List of 
    Figures

    

    
 

    
I’d like a bookmark for the List 
    of Figures to appear in the list of PDF bookmarks. Does anyone know how I 
    can add that bookmark?

    
 

    
Regards,

    
Jeff 
  Powanda