List Info

Thread: Re: list of figures in the TOC for an appendix




Re: list of figures in the TOC for an appendix
user name
2007-04-11 08:12:24
Hi Andreas

The code you tried needs to be embedded in the template match=&quot;appendix&quot; copied from the standard XSL stylesheet.  You also need to ask for the TOC with the <xsl:param name"generate.toc"> parameter.  Below is a copy direct from my present stylesheet customization, and works OK for me today.&nbsp; The bit you tried is now embedded in the system template match=&quot;appendix&quot;, near the bottom, 2 or 3 up.&nbsp; The first four of the templates are the standard null ones.

Bob Stayton wrote
>>&gt;
Hi Ron,
Lists of figures, tables, etc. is only implemented for the book element.&nbsp; I think perhaps it was intended to be extended to other elements, but never was.
&nbsp;
I think it might be as easy as adding something like this to an appendix customization:
&nbsp;
 &nbsp; &nbsp; &nbsp;  <xsl:call-template name=";list.of.titles"&gt;
 ; &nbsp; &nbsp; &nbsp; &nbsp; <xsl:with-param name=";titles&quot; select="'figure'"/&gt;
 ; &nbsp; &nbsp; &nbsp; &nbsp; <xsl:with-param name=";nodes"; select=&quot;.//figure"/&gt;
 ; &nbsp; &nbsp; &nbsp; </xsl:call-template>
>>;>

Hope this helps.

Ron

<!-- generate tables of contents for book, preface, parts chapters and appendices  ; -->
<!-- List of Figures removed for this project from "book toc,title,table,figure,example,equation&quot; -->
<!-- List of toc,title removed for this project from "appendix  toc,title&quot; --&gt;
<xsl:param name="generate.toc&quot; >
appendix  toc,title,figure
article   toc,title
book ; &nbsp; &nbsp; toc,title
chapter&nbsp;  toc,title
part ; &nbsp; &nbsp; toc,title
preface&nbsp;  title
reference toc,title
sect1&nbsp; &nbsp;  title
sect2 &nbsp; &nbsp; title
sect3 &nbsp; &nbsp; title
sect4 &nbsp; &nbsp; title
sect5 &nbsp; &nbsp; title
section   title
</xsl:param>
<xsl:template match="appendix/docinfo|appendixinfo"></xsl:template>

<xsl:template match="appendix/title&quot;></xsl:template>

<xsl:template match="appendix/titleabbrev"></xsl:template>

<xsl:template match="appendix/subtitle"></xsl:template>

<xsl:template match="appendix">
 
<xsl:variable name="id&quot;>
 &nbsp; 
<xsl:call-template name="object.id"/>
 
</xsl:variable&gt;

&nbsp;
<xsl:variable name="master-reference">
 &nbsp; 
<xsl:call-template name="select.pagemaster"/>
 
</xsl:variable&gt;

&nbsp;
<fo:page-sequence hyphenate="$hyphenate";
 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp;   ;  master-reference="$master-reference">
 &nbsp; 
<xsl:attribute name="language">
 &nbsp;   ;
<xsl:call-template name="l10n.language&quot;/>
 &nbsp; 
</xsl:attribute&gt;
 &nbsp; 
<xsl:attribute name="format">
 &nbsp;   ;
<xsl:call-template name="page.number.format">
 &nbsp;   ; &nbsp;
<xsl:with-param name="master-reference" select="$master-reference"/>
 &nbsp;   ;
</xsl:call-template>
 &nbsp; 
</xsl:attribute&gt;
 &nbsp; 
<xsl:attribute name="initial-page-number">
 &nbsp;   ;
<xsl:call-template name="initial.page.number">
 &nbsp;   ; &nbsp;
<xsl:with-param name="master-reference" select="$master-reference"/>
 &nbsp;   ;
</xsl:call-template>
 &nbsp; 
</xsl:attribute&gt;

&nbsp; &nbsp;
<xsl:attribute name="force-page-count">
 &nbsp;   ;
<xsl:call-template name="force.page.count">
 &nbsp;   ; &nbsp;
<xsl:with-param name="master-reference" select="$master-reference"/>
 &nbsp;   ;
</xsl:call-template>
 &nbsp; 
</xsl:attribute&gt;

&nbsp; &nbsp;
<xsl:attribute name="hyphenation-character";>
 &nbsp;   ;
<xsl:call-template name="gentext">
 &nbsp;   ; &nbsp;
<xsl:with-param name="key&quot; select="'hyphenation-character'&quot;/>
 &nbsp;   ;
</xsl:call-template>
 &nbsp; 
</xsl:attribute&gt;
 &nbsp; 
<xsl:attribute name="hyphenation-push-character-count";>
 &nbsp;   ;
<xsl:call-template name="gentext">
 &nbsp;   ; &nbsp;
<xsl:with-param name="key&quot; select="'hyphenation-push-character-count'&quot;/>
 &nbsp;   ;
</xsl:call-template>
 &nbsp; 
</xsl:attribute&gt;
 &nbsp; 
<xsl:attribute name="hyphenation-remain-character-count&quot;>
 &nbsp;   ;
<xsl:call-template name="gentext">
 &nbsp;   ; &nbsp;
<xsl:with-param name="key&quot; select="'hyphenation-remain-character-count'&quot;/>
 &nbsp;   ;
</xsl:call-template>
 &nbsp; 
</xsl:attribute&gt;

&nbsp; &nbsp;
<xsl:apply-templates select=".&quot; mode="running.head.mode">
 &nbsp;   ;
<xsl:with-param name="master-reference" select="$master-reference"/>
 &nbsp; 
</xsl:apply-templates>

&nbsp; &nbsp;
<xsl:apply-templates select=".&quot; mode="running.foot.mode">
 &nbsp;   ;
<xsl:with-param name="master-reference" select="$master-reference"/>
 &nbsp; 
</xsl:apply-templates>

&nbsp; &nbsp;
<fo:flow flow-name="xsl-region-body">
 &nbsp; &nbsp;  <xsl:call-template name="set.flow.properties">
 &nbsp;   ; &nbsp;
<xsl:with-param name="element" select="local-name(.)&quot;/>
 &nbsp;   ; &nbsp;
<xsl:with-param name="master-reference" select="$master-reference"/>
 &nbsp;   ;
</xsl:call-template>

&nbsp; &nbsp; &nbsp;
<fo:block id="$id&quot;>
 &nbsp;   ; &nbsp;
<xsl:call-template name="appendix.titlepage"/>
 &nbsp;   ; &nbsp;
<xsl:call-template name="list.of.titles&quot;>
 &nbsp;   ; &nbsp; &nbsp;
<xsl:with-param name="titles" select="'figure'"/>
 &nbsp;   ; &nbsp; &nbsp;
<xsl:with-param name="nodes" select=".//figure"/>
 &nbsp;   ; &nbsp;
</xsl:call-template>
 &nbsp;   ;
</fo:block>

&nbsp; &nbsp; &nbsp;
<xsl:variable name="toc.params";>
 &nbsp;   ; &nbsp;
<xsl:call-template name="find.path.params">
 &nbsp;   ; &nbsp; &nbsp;
<xsl:with-param name="table" select="normalize-space($generate.toc)"/>
 &nbsp;   ; &nbsp;
</xsl:call-template>
 &nbsp;   ;
</xsl:variable&gt;

&nbsp; &nbsp; &nbsp;
<xsl:if test="contains($toc.params, 'toc')&quot;>
 &nbsp;   ; &nbsp;
<xsl:call-template name="component.toc&quot;>
 &nbsp;   ; &nbsp; &nbsp;
<xsl:with-param name="toc.title.p&quot;
 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp;   ; &nbsp; &nbsp;   ; select="contains($toc.params, 'title')"/>
 &nbsp;   ; &nbsp;
</xsl:call-template>
 &nbsp;   ; &nbsp;
<xsl:call-template name="component.toc.separator&quot;/>
 &nbsp;   ;
</xsl:if>
 &nbsp;   ;
<xsl:apply-templates/>
 &nbsp; 
</fo:flow>
 
</fo:page-sequence>
</xsl:template>



Hi Ron,

I&nbsp;was&nbsp;searching for&nbsp;a possibility to&nbsp;add&nbsp;a list of figures to&nbsp;my&nbsp;docbook article. I&nbsp;found&nbsp;that&nbsp;you&nbsp;just&nbsp;had ;the same problem and you found following solution:

<!-- list.of.titles&nbsp;code&nbsp;added&nbsp;to template&nbsp;match="appendix"&nbsp;to ;generate&nbsp;a&nbsp;list ;of figures at start of&nbsp;an&nbsp;appendix --&gt;
   ; &nbsp; <;fo:block&nbsp;id=&quot;$id&quot;>
&nbsp; &nbsp;   ; &nbsp;<xsl:call-template name="appendix.titlepage"/>
&nbsp; &nbsp; &nbsp;   ;<xsl:call-template name="list.of.titles">
 &nbsp; &nbsp; &nbsp;   ; <xsl:with-param name="titles"; select="'figure'&quot;/>
  ; &nbsp; &nbsp; &nbsp; &nbsp;<xsl:with-param name="nodes"&nbsp;select=".//figure";/>
&nbsp; &nbsp;   ; &nbsp;</xsl:call-template>
  ; &nbsp; &nbsp;</fo:block>

I'm pretty new to docbook and docbook stylesheets. I could not find the right place to add those lines. I tried to add them to my customization file, but it did not work. Where do I add this template, or which original template do I have to change?

I hope you can help me.

Greetings
Andreas Post


-- 
Ron Catterall, Phd, DSc &nbsp; &nbsp;     ; &nbsp; &nbsp;   &nbsp; &nbsp; &nbsp;  email: roncatterall.net
Prolongacion de Hidalgo 140     ; &nbsp; &nbsp;   &nbsp; &nbsp; &nbsp;   &nbsp;   ; &nbsp; http://catterall.net/
San Felipe del Agua ; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;   &nbsp;   ; &nbsp;   &nbsp; &nbsp; &nbsp;   &nbsp; &nbsp;   ; tel: +52 951 520 1821
Oaxaca &nbsp; &nbsp;  68020&nbsp; Mexico    ; &nbsp; &nbsp;   &nbsp; &nbsp; &nbsp;   &nbsp;   ; &nbsp; fax: +1 530 348 8309
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )