docbook-apps

Re: [docbook-apps] controlling ToC depth for an article with nested sections (DB5)

  • 1.  Re: [docbook-apps] controlling ToC depth for an article with nested sections (DB5)

    Posted 08-14-2007 18:46
    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:
    >
    >
    > <xsl:param name="generate.toc" >
    > appendix toc,title,figure
    > book toc,title
    > chapter title
    > preface title
    > </xsl:param>
    >
    >
    >
    >
    >
    > <xsl:template match="appendix/docinfo|appendixinfo"></xsl:template>
    >
    > <xsl:template match="appendix/title"></xsl:template>
    >
    > <xsl:template match="appendix/titleabbrev"></xsl:template>
    >
    > <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>
    >
    >
    > <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-unsubscribe@lists.oasis-open.org
    >> For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org
    >
    >
    > --
    >
    > Ron Catterall, Phd, DSc email: ron@catterall.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