List Info

Thread: controlling ToC depth for an article with nested sections (DB5)




controlling ToC depth for an article with nested sections (DB5)
user name
2007-08-14 09:18:47
I'm currently stuck in trying to get DocBook to produce ToCs
in FO/PDF 
output for nested sections more than 0 levels deep. I see a
ToC for 
article/section, but not one for article/section/section.

In my customization layer, I have:

   <xsl:param name="generate.toc">
     appendix toc,title
     article  toc,title
     section  toc
   </xsl:param>

   <xsl:param name="generate.section.toc.level"
select="5" />

Using 1.73.0 (NS) and a DB5-valid doc.

Any ideas?

Thanks,

Brett


------------------------------------------------------------
---------
To unsubscribe, e-mail: docbook-apps-unsubscribelists.oasis-open.org
For additional commands, e-mail: docbook-apps-helplists.oasis-open.org


Re: controlling ToC depth for an article with nested sections (DB5)
user name
2007-08-14 13:45:54
Thanks, Ron. With toc.section.depth set to 4, I now get the
ToCs at the
desired section levels. Setting this parameter, however, has
the
undesired consequence of increasing the depth of even the
top-level
article ToC. What I want is shallow ToCs, but generated for
sections
nested four levels deep.

My understanding was that:

- toc.section.depth controls depth of recursive sections in
individual ToCs
- generate.section.toc.level controls the depth of sections
for which
ToCs should be generated.

But looking at Table 9.3 in Bob's book now, I see that there
is an
interaction between these two parameters, which is
undesirable in my
case. Quoting from DocBook XSL: The Complete Guide :

"In other cases, there is no TOC because the
toc.section.depth parameter
prevents it from having any entries."

But if I increase toc.section.depth, then I get deeper ToCs
at the
higher levels (article and article/section, for example)!

I have to admit this is rather frustrating. I might have to
abandon deep
ToCs altogether, as I'm trying to create a navigable PDF
that documents
a DTD. Since XML elements are described in their own
sections, I'm
getting very deep ToCs where I don't want them.

Thanks,

Brett


On 8/14/2007 10:55 AM, Ron Catterall wrote:
> Try setting toc.section.depth parameter to 3 or
greater, the default is 
> 2 which gives Chapter, sect1 and sect2 in the TOC
> toc.max.depth has a default of 7, so toc.section.depth
overrides
> See p.122-3 of Bob Stayton, DocBook XSL the Complete
Guide
> 
> You may have trouble with TOC for an appendix, for e.g.
to get a list of 
> figures in a TOC (with XEP) for an appendix I use:
> <!-- 
>
============================================================
======== -->
> <!-- generate tables of contents for book, preface,
chapters and 
> appendices  -->
> <xsl:param name="generate.toc" >
>  appendix  toc,title,figure
>  book   toc,title
>  chapter       title
>  preface       title
> </xsl:param>
> <!--
> Note.  This code works OK in a <book>, but gives
fatal errors in the fo 
> file if tried for an appendix in an article
>  -->
> 
> <!-- 
>
============================================================
======== -->
> <!-- list.of.titles code added to generate a list of
figures at start of 
> an appendix
>  -->
> 
> <xsl:template
match="appendix/docinfo|appendixinfo"></xsl:
template>
> 
> <xsl:template
match="appendix/title"></xsl:template>
> 
> <xsl:template
match="appendix/titleabbrev"></xsl:template&
gt;
> 
> <xsl:template
match="appendix/subtitle"></xsl:template>

> 
> <xsl:template match="appendix">
>   <xsl:variable name="id">
>     <xsl:call-template
name="object.id"/>
>   </xsl:variable>
> 
>   <xsl:variable
name="master-reference">
>     <xsl:call-template
name="select.pagemaster"/>
>   </xsl:variable>
> 
>   <fo:page-sequence
hyphenate="{$hyphenate}"
>                    
master-reference="{$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="$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="$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="$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="$master-reference"/>
>     </xsl:apply-templates>
> 
>     <xsl:apply-templates select="."
mode="running.foot.mode">
>       <xsl:with-param
name="master-reference"
select="$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="$master-reference"/>
>       </xsl:call-template>
> 
> <!-- list.of.titles code added to generate a list of
figures at start of 
> an appendix  -->
>       <fo:block id="{$id}">
>         <xsl:call-template
name="appendix.titlepage"/>
>         <xsl:call-template
name="list.of.titles">
>           <xsl:with-param name="titles"
select="'figure'"/>
>           <xsl:with-param name="nodes"
select=".//figure"/>
>         </xsl:call-template>
>       </fo:block>
> <!--  -->
> 
>       <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')">
>         <xsl:call-template
name="component.toc">
>           <xsl:with-param
name="toc.title.p"
>                          
select="contains($toc.params, 'title')"/>
>         </xsl:call-template>
>         <xsl:call-template
name="component.toc.separator"/>
>       </xsl:if>
>       <xsl:apply-templates/>
>     </fo:flow>
>   </fo:page-sequence>
> </xsl:template>
> 
>> I'm currently stuck in trying to get DocBook to
produce ToCs in FO/PDF 
>> output for nested sections more than 0 levels deep.
I see a ToC for 
>> article/section, but not one for
article/section/section.
>>
>> In my customization layer, I have:
>>
>>   <xsl:param name="generate.toc">
>>     appendix toc,title
>>     article  toc,title
>>     section  toc
>>   </xsl:param>
>>
>>   <xsl:param
name="generate.section.toc.level"
select="5" />
>>
>> Using 1.73.0 (NS) and a DB5-valid doc.
>>
>> Any ideas?
>>
>> Thanks,
>>
>> Brett
>>
>>
>>
------------------------------------------------------------
---------
>> To unsubscribe, e-mail:
docbook-apps-unsubscribelists.oasis-open.org
>> For additional commands, e-mail:
docbook-apps-helplists.oasis-open.org
> 
> 
> -- 
> 
> Ron Catterall, Phd, DSc                         email:
roncatterall.net
> Prolongacion de Hidalgo 140                            

> http://catterall.net/
> San Felipe del Agua                                    
   tel: +52 951 
> 520 1821
> Oaxaca      68020  Mexico                          fax:
+1 530 348 8309


------------------------------------------------------------
---------
To unsubscribe, e-mail: docbook-apps-unsubscribelists.oasis-open.org
For additional commands, e-mail: docbook-apps-helplists.oasis-open.org


Re: controlling ToC depth for an article with nested sections (DB5)
user name
2007-08-15 11:11:33
Hi Ron,
This customization works the way you want it.  If you look
in 
fo/autotoc.xsl, you will see that the children of an element
for which you 
are generating a toc are processed in mode="toc",
and with a param named 
"toc-context", which is the element for which you
are generating the toc. 
This customization handles only nested sections, and checks
the 
$toc-context to see if it should proceed.  If the context is
article and 
the depth is greater than 1, then it does not apply-imports.
 You can 
adjust the values as needed.

<xsl:param
name="generate.section.toc.level">4</xsl:par
am>
<xsl:param
name="toc.section.depth">4</xsl:param>
<xsl:param name="generate.toc">
article toc,title
section toc
</xsl:param>


<xsl:template
match="section[ancestor::section]"
mode="toc">
  <xsl:param name="toc-context"
select="NOTANODE"/>

  <xsl:variable name="section.depth" 
select="count(ancestor-or-self::section)"/>
  <xsl:choose>
    <xsl:when test="$toc-context/self::article and
                    $section.depth &gt; 1">
      <!-- do nothing -->
    </xsl:when>
    <xsl:otherwise>
      <xsl:apply-imports/>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>


Bob Stayton
Sagehill Enterprises
DocBook Consulting
bobssagehill.net


----- Original Message ----- 
From: "Brett Leber" <bleber+cs.cmu.edu>
To: "Ron Catterall" <roncatterall.net>
Cc: <docbook-appslists.oasis-open.org>
Sent: Tuesday, August 14, 2007 11:45 AM
Subject: Re: [docbook-apps] controlling ToC depth for an
article with 
nested sections (DB5)


> Thanks, Ron. With toc.section.depth set to 4, I now get
the ToCs at the
> desired section levels. Setting this parameter,
however, has the
> undesired consequence of increasing the depth of even
the top-level
> article ToC. What I want is shallow ToCs, but generated
for sections
> nested four levels deep.
>
> My understanding was that:
>
> - toc.section.depth controls depth of recursive
sections in individual 
> ToCs
> - generate.section.toc.level controls the depth of
sections for which
> ToCs should be generated.
>
> But looking at Table 9.3 in Bob's book now, I see that
there is an
> interaction between these two parameters, which is
undesirable in my
> case. Quoting from DocBook XSL: The Complete Guide :
>
> "In other cases, there is no TOC because the
toc.section.depth parameter
> prevents it from having any entries."
>
> But if I increase toc.section.depth, then I get deeper
ToCs at the
> higher levels (article and article/section, for
example)!
>
> I have to admit this is rather frustrating. I might
have to abandon deep
> ToCs altogether, as I'm trying to create a navigable
PDF that documents
> a DTD. Since XML elements are described in their own
sections, I'm
> getting very deep ToCs where I don't want them.
>
> Thanks,
>
> Brett
>
>
> On 8/14/2007 10:55 AM, Ron Catterall wrote:
>> Try setting toc.section.depth parameter to 3 or
greater, the default is 
>> 2 which gives Chapter, sect1 and sect2 in the TOC
>> toc.max.depth has a default of 7, so
toc.section.depth overrides
>> See p.122-3 of Bob Stayton, DocBook XSL the
Complete Guide
>>
>> You may have trouble with TOC for an appendix, for
e.g. to get a list of 
>> figures in a TOC (with XEP) for an appendix I use:
>> <!-- 
>>
============================================================
======== -->
>> <!-- generate tables of contents for book,
preface, chapters and 
>> appendices  -->
>> <xsl:param name="generate.toc" >
>>  appendix  toc,title,figure
>>  book   toc,title
>>  chapter       title
>>  preface       title
>> </xsl:param>
>> <!--
>> Note.  This code works OK in a <book>, but
gives fatal errors in the fo 
>> file if tried for an appendix in an article
>>  -->
>>
>> <!-- 
>>
============================================================
======== -->
>> <!-- list.of.titles code added to generate a
list of figures at start of 
>> an appendix
>>  -->
>>
>> <xsl:template
match="appendix/docinfo|appendixinfo"></xsl:
template>
>>
>> <xsl:template
match="appendix/title"></xsl:template>
>>
>> <xsl:template
match="appendix/titleabbrev"></xsl:template&
gt;
>>
>> <xsl:template
match="appendix/subtitle"></xsl:template>

>>
>> <xsl:template match="appendix">
>>   <xsl:variable name="id">
>>     <xsl:call-template
name="object.id"/>
>>   </xsl:variable>
>>
>>   <xsl:variable
name="master-reference">
>>     <xsl:call-template
name="select.pagemaster"/>
>>   </xsl:variable>
>>
>>   <fo:page-sequence
hyphenate="{$hyphenate}"
>>                    
master-reference="{$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="$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="$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="$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="$master-reference"/>
>>     </xsl:apply-templates>
>>
>>     <xsl:apply-templates select="."
mode="running.foot.mode">
>>       <xsl:with-param
name="master-reference" 
>> select="$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="$master-reference"/>
>>       </xsl:call-template>
>>
>> <!-- list.of.titles code added to generate a
list of figures at start of 
>> an appendix  -->
>>       <fo:block id="{$id}">
>>         <xsl:call-template
name="appendix.titlepage"/>
>>         <xsl:call-template
name="list.of.titles">
>>           <xsl:with-param
name="titles" select="'figure'"/>
>>           <xsl:with-param name="nodes"
select=".//figure"/>
>>         </xsl:call-template>
>>       </fo:block>
>> <!--  -->
>>
>>       <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')">
>>         <xsl:call-template
name="component.toc">
>>           <xsl:with-param
name="toc.title.p"
>>                          
select="contains($toc.params, 'title')"/>
>>         </xsl:call-template>
>>         <xsl:call-template
name="component.toc.separator"/>
>>       </xsl:if>
>>       <xsl:apply-templates/>
>>     </fo:flow>
>>   </fo:page-sequence>
>> </xsl:template>
>>
>>> I'm currently stuck in trying to get DocBook to
produce ToCs in FO/PDF 
>>> output for nested sections more than 0 levels
deep. I see a ToC for 
>>> article/section, but not one for
article/section/section.
>>>
>>> In my customization layer, I have:
>>>
>>>   <xsl:param
name="generate.toc">
>>>     appendix toc,title
>>>     article  toc,title
>>>     section  toc
>>>   </xsl:param>
>>>
>>>   <xsl:param
name="generate.section.toc.level"
select="5" />
>>>
>>> Using 1.73.0 (NS) and a DB5-valid doc.
>>>
>>> Any ideas?
>>>
>>> Thanks,
>>>
>>> Brett
>>>
>>>
>>>
------------------------------------------------------------
---------
>>> To unsubscribe, e-mail:
docbook-apps-unsubscribelists.oasis-open.org
>>> For additional commands, e-mail:
docbook-apps-helplists.oasis-open.org
>>
>>
>> -- 
>>
>> Ron Catterall, Phd, DSc                        
email: roncatterall.net
>> Prolongacion de Hidalgo 140 
>> http://catterall.net/
>> San Felipe del Agua                                
       tel: +52 951 
>> 520 1821
>> Oaxaca      68020  Mexico                         
fax: +1 530 348 8309
>
>
>
------------------------------------------------------------
---------
> To unsubscribe, e-mail: docbook-apps-unsubscribelists.oasis-open.org
> For additional commands, e-mail: docbook-apps-helplists.oasis-open.org
>
>
> 



------------------------------------------------------------
---------
To unsubscribe, e-mail: docbook-apps-unsubscribelists.oasis-open.org
For additional commands, e-mail: docbook-apps-helplists.oasis-open.org


Re: controlling ToC depth for an article with nested sections (DB5)
user name
2007-08-15 11:15:57
Sorry, I meant to address that last one to Brett who asked
the question.

Bob Stayton
Sagehill Enterprises
DocBook Consulting
bobssagehill.net


----- Original Message ----- 
From: "Brett Leber" <bleber+cs.cmu.edu>
To: "Ron Catterall" <roncatterall.net>
Cc: <docbook-appslists.oasis-open.org>
Sent: Tuesday, August 14, 2007 11:45 AM
Subject: Re: [docbook-apps] controlling ToC depth for an
article with 
nested sections (DB5)


> Thanks, Ron. With toc.section.depth set to 4, I now get
the ToCs at the
> desired section levels. Setting this parameter,
however, has the
> undesired consequence of increasing the depth of even
the top-level
> article ToC. What I want is shallow ToCs, but generated
for sections
> nested four levels deep.
>
> My understanding was that:
>
> - toc.section.depth controls depth of recursive
sections in individual 
> ToCs
> - generate.section.toc.level controls the depth of
sections for which
> ToCs should be generated.
>
> But looking at Table 9.3 in Bob's book now, I see that
there is an
> interaction between these two parameters, which is
undesirable in my
> case. Quoting from DocBook XSL: The Complete Guide :
>
> "In other cases, there is no TOC because the
toc.section.depth parameter
> prevents it from having any entries."
>
> But if I increase toc.section.depth, then I get deeper
ToCs at the
> higher levels (article and article/section, for
example)!
>
> I have to admit this is rather frustrating. I might
have to abandon deep
> ToCs altogether, as I'm trying to create a navigable
PDF that documents
> a DTD. Since XML elements are described in their own
sections, I'm
> getting very deep ToCs where I don't want them.
>
> Thanks,
>
> Brett
>
>
> On 8/14/2007 10:55 AM, Ron Catterall wrote:
>> Try setting toc.section.depth parameter to 3 or
greater, the default is 
>> 2 which gives Chapter, sect1 and sect2 in the TOC
>> toc.max.depth has a default of 7, so
toc.section.depth overrides
>> See p.122-3 of Bob Stayton, DocBook XSL the
Complete Guide
>>
>> You may have trouble with TOC for an appendix, for
e.g. to get a list of 
>> figures in a TOC (with XEP) for an appendix I use:
>> <!-- 
>>
============================================================
======== -->
>> <!-- generate tables of contents for book,
preface, chapters and 
>> appendices  -->
>> <xsl:param name="generate.toc" >
>>  appendix  toc,title,figure
>>  book   toc,title
>>  chapter       title
>>  preface       title
>> </xsl:param>
>> <!--
>> Note.  This code works OK in a <book>, but
gives fatal errors in the fo 
>> file if tried for an appendix in an article
>>  -->
>>
>> <!-- 
>>
============================================================
======== -->
>> <!-- list.of.titles code added to generate a
list of figures at start of 
>> an appendix
>>  -->
>>
>> <xsl:template
match="appendix/docinfo|appendixinfo"></xsl:
template>
>>
>> <xsl:template
match="appendix/title"></xsl:template>
>>
>> <xsl:template
match="appendix/titleabbrev"></xsl:template&
gt;
>>
>> <xsl:template
match="appendix/subtitle"></xsl:template>

>>
>> <xsl:template match="appendix">
>>   <xsl:variable name="id">
>>     <xsl:call-template
name="object.id"/>
>>   </xsl:variable>
>>
>>   <xsl:variable
name="master-reference">
>>     <xsl:call-template
name="select.pagemaster"/>
>>   </xsl:variable>
>>
>>   <fo:page-sequence
hyphenate="{$hyphenate}"
>>                    
master-reference="{$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="$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="$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="$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="$master-reference"/>
>>     </xsl:apply-templates>
>>
>>     <xsl:apply-templates select="."
mode="running.foot.mode">
>>       <xsl:with-param
name="master-reference" 
>> select="$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="$master-reference"/>
>>       </xsl:call-template>
>>
>> <!-- list.of.titles code added to generate a
list of figures at start of 
>> an appendix  -->
>>       <fo:block id="{$id}">
>>         <xsl:call-template
name="appendix.titlepage"/>
>>         <xsl:call-template
name="list.of.titles">
>>           <xsl:with-param
name="titles" select="'figure'"/>
>>           <xsl:with-param name="nodes"
select=".//figure"/>
>>         </xsl:call-template>
>>       </fo:block>
>> <!--  -->
>>
>>       <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')">
>>         <xsl:call-template
name="component.toc">
>>           <xsl:with-param
name="toc.title.p"
>>                          
select="contains($toc.params, 'title')"/>
>>         </xsl:call-template>
>>         <xsl:call-template
name="component.toc.separator"/>
>>       </xsl:if>
>>       <xsl:apply-templates/>
>>     </fo:flow>
>>   </fo:page-sequence>
>> </xsl:template>
>>
>>> I'm currently stuck in trying to get DocBook to
produce ToCs in FO/PDF 
>>> output for nested sections more than 0 levels
deep. I see a ToC for 
>>> article/section, but not one for
article/section/section.
>>>
>>> In my customization layer, I have:
>>>
>>>   <xsl:param
name="generate.toc">
>>>     appendix toc,title
>>>     article  toc,title
>>>     section  toc
>>>   </xsl:param>
>>>
>>>   <xsl:param
name="generate.section.toc.level"
select="5" />
>>>
>>> Using 1.73.0 (NS) and a DB5-valid doc.
>>>
>>> Any ideas?
>>>
>>> Thanks,
>>>
>>> Brett
>>>
>>>
>>>
------------------------------------------------------------
---------
>>> To unsubscribe, e-mail:
docbook-apps-unsubscribelists.oasis-open.org
>>> For additional commands, e-mail:
docbook-apps-helplists.oasis-open.org
>>
>>
>> -- 
>>
>> Ron Catterall, Phd, DSc                        
email: roncatterall.net
>> Prolongacion de Hidalgo 140 
>> http://catterall.net/
>> San Felipe del Agua                                
       tel: +52 951 
>> 520 1821
>> Oaxaca      68020  Mexico                         
fax: +1 530 348 8309
>
>
>
------------------------------------------------------------
---------
> To unsubscribe, e-mail: docbook-apps-unsubscribelists.oasis-open.org
> For additional commands, e-mail: docbook-apps-helplists.oasis-open.org
>
>
> 



------------------------------------------------------------
---------
To unsubscribe, e-mail: docbook-apps-unsubscribelists.oasis-open.org
For additional commands, e-mail: docbook-apps-helplists.oasis-open.org


Re: controlling ToC depth for an article with nested sections (DB5)
user name
2007-08-16 08:39:09
Thanks, Bob. I might not use this customization for this
document, but I 
would certainly consider it for others.

Is there a repository of customizations like this one (on
the wiki 
perhaps)? It seems that customizations are frequently
innovated, but 
often lost, saved only in the email archives of this list.

Cheers,

Brett

On 8/15/2007 12:15 PM, Bob Stayton wrote:
> Sorry, I meant to address that last one to Brett who
asked the question.
> 
> Bob Stayton
> Sagehill Enterprises
> DocBook Consulting
> bobssagehill.net
> 
> 
> ----- Original Message ----- From: "Brett
Leber" <bleber+cs.cmu.edu>
> To: "Ron Catterall" <roncatterall.net>
> Cc: <docbook-appslists.oasis-open.org>
> Sent: Tuesday, August 14, 2007 11:45 AM
> Subject: Re: [docbook-apps] controlling ToC depth for
an article with 
> nested sections (DB5)
> 
> 
>> Thanks, Ron. With toc.section.depth set to 4, I now
get the ToCs at the
>> desired section levels. Setting this parameter,
however, has the
>> undesired consequence of increasing the depth of
even the top-level
>> article ToC. What I want is shallow ToCs, but
generated for sections
>> nested four levels deep.
>>
>> My understanding was that:
>>
>> - toc.section.depth controls depth of recursive
sections in individual 
>> ToCs
>> - generate.section.toc.level controls the depth of
sections for which
>> ToCs should be generated.
>>
>> But looking at Table 9.3 in Bob's book now, I see
that there is an
>> interaction between these two parameters, which is
undesirable in my
>> case. Quoting from DocBook XSL: The Complete Guide
:
>>
>> "In other cases, there is no TOC because the
toc.section.depth parameter
>> prevents it from having any entries."
>>
>> But if I increase toc.section.depth, then I get
deeper ToCs at the
>> higher levels (article and article/section, for
example)!
>>
>> I have to admit this is rather frustrating. I might
have to abandon deep
>> ToCs altogether, as I'm trying to create a
navigable PDF that documents
>> a DTD. Since XML elements are described in their
own sections, I'm
>> getting very deep ToCs where I don't want them.
>>
>> Thanks,
>>
>> Brett
>>
>>
>> On 8/14/2007 10:55 AM, Ron Catterall wrote:
>>> Try setting toc.section.depth parameter to 3 or
greater, the default 
>>> is 2 which gives Chapter, sect1 and sect2 in
the TOC
>>> toc.max.depth has a default of 7, so
toc.section.depth overrides
>>> See p.122-3 of Bob Stayton, DocBook XSL the
Complete Guide
>>>
>>> You may have trouble with TOC for an appendix,
for e.g. to get a list 
>>> of figures in a TOC (with XEP) for an appendix
I use:
>>> <!-- 
>>>
============================================================
======== -->
>>> <!-- generate tables of contents for book,
preface, chapters and 
>>> appendices  -->
>>> <xsl:param name="generate.toc"
>
>>>  appendix  toc,title,figure
>>>  book   toc,title
>>>  chapter       title
>>>  preface       title
>>> </xsl:param>
>>> <!--
>>> Note.  This code works OK in a <book>,
but gives fatal errors in the 
>>> fo file if tried for an appendix in an article
>>>  -->
>>>
>>> <!-- 
>>>
============================================================
======== -->
>>> <!-- list.of.titles code added to generate a
list of figures at start 
>>> of an appendix
>>>  -->
>>>
>>> <xsl:template
match="appendix/docinfo|appendixinfo"></xsl:
template>
>>>
>>> <xsl:template
match="appendix/title"></xsl:template>
>>>
>>> <xsl:template
match="appendix/titleabbrev"></xsl:template&
gt;
>>>
>>> <xsl:template
match="appendix/subtitle"></xsl:template>

>>>
>>> <xsl:template
match="appendix">
>>>   <xsl:variable name="id">
>>>     <xsl:call-template
name="object.id"/>
>>>   </xsl:variable>
>>>
>>>   <xsl:variable
name="master-reference">
>>>     <xsl:call-template
name="select.pagemaster"/>
>>>   </xsl:variable>
>>>
>>>   <fo:page-sequence
hyphenate="{$hyphenate}"
>>>                    
master-reference="{$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="$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="$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="$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="$master-reference"/>
>>>     </xsl:apply-templates>
>>>
>>>     <xsl:apply-templates
select="." mode="running.foot.mode">
>>>       <xsl:with-param
name="master-reference" 
>>> select="$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="$master-reference"/>
>>>       </xsl:call-template>
>>>
>>> <!-- list.of.titles code added to generate a
list of figures at start 
>>> of an appendix  -->
>>>       <fo:block id="{$id}">
>>>         <xsl:call-template
name="appendix.titlepage"/>
>>>         <xsl:call-template
name="list.of.titles">
>>>           <xsl:with-param
name="titles" select="'figure'"/>
>>>           <xsl:with-param
name="nodes" select=".//figure"/>
>>>         </xsl:call-template>
>>>       </fo:block>
>>> <!--  -->
>>>
>>>       <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')">
>>>         <xsl:call-template
name="component.toc">
>>>           <xsl:with-param
name="toc.title.p"
>>>                          
select="contains($toc.params, 'title')"/>
>>>         </xsl:call-template>
>>>         <xsl:call-template
name="component.toc.separator"/>
>>>       </xsl:if>
>>>       <xsl:apply-templates/>
>>>     </fo:flow>
>>>   </fo:page-sequence>
>>> </xsl:template>
>>>
>>>> I'm currently stuck in trying to get
DocBook to produce ToCs in 
>>>> FO/PDF output for nested sections more than
0 levels deep. I see a 
>>>> ToC for article/section, but not one for
article/section/section.
>>>>
>>>> In my customization layer, I have:
>>>>
>>>>   <xsl:param
name="generate.toc">
>>>>     appendix toc,title
>>>>     article  toc,title
>>>>     section  toc
>>>>   </xsl:param>
>>>>
>>>>   <xsl:param
name="generate.section.toc.level"
select="5" />
>>>>
>>>> Using 1.73.0 (NS) and a DB5-valid doc.
>>>>
>>>> Any ideas?
>>>>
>>>> Thanks,
>>>>
>>>> Brett
>>>>
>>>>
>>>>
------------------------------------------------------------
---------
>>>> To unsubscribe, e-mail:
docbook-apps-unsubscribelists.oasis-open.org
>>>> For additional commands, e-mail:
docbook-apps-helplists.oasis-open.org
>>>
>>>
>>> -- 
>>>
>>> Ron Catterall, Phd, DSc                        
email: roncatterall.net
>>> Prolongacion de Hidalgo 140 http://catterall.net/
>>> San Felipe del Agua                            
           tel: +52 
>>> 951 520 1821
>>> Oaxaca      68020  Mexico                      
   fax: +1 530 348 8309
>>
>>
>>
------------------------------------------------------------
---------
>> To unsubscribe, e-mail:
docbook-apps-unsubscribelists.oasis-open.org
>> For additional commands, e-mail:
docbook-apps-helplists.oasis-open.org
>>
>>
>>
> 
> 
> 

------------------------------------------------------------
---------
To unsubscribe, e-mail: docbook-apps-unsubscribelists.oasis-open.org
For additional commands, e-mail: docbook-apps-helplists.oasis-open.org


[1-5]

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