OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: [docbook-apps] can I move the table of contents?


Morning,

>  "some implementations use completely empty index tags to
>   indicate where an automatically generated index should be
>   inserted. so [...]"

Dominik, if I understood it correctly, Lorenzo talks about the table of
contents, not the index. :)


Back to Lorenzos original question:

> My question: Is there a way I can specify to generate the Table of
> Contents within a specific section instead that at very beginning of
> the document? (For example, some DocBook XSL option...)

I guess you mean to move the TOC to the end of, lets say, a book? Yes,
the DocBook stylesheets has lots of ways how to do this. The easiest
method is to set a parameter, but in this case, I fear, there is none. 

However, if there is no parameter, you have to customize the
respective template(s). First you have to create a customization layer
(see [1] or [2]). Then you have to overwrite the standard
implementation. For example, if you want to move the TOC of a book to
the end, look at html/division.xsl and the "book" template. Here is the
code:

-----------[ html/division.xsl ]-----------
<xsl:template match="book">
  <xsl:call-template name="id.warning"/>

  <div>
    <xsl:apply-templates select="." mode="common.html.attributes"/>
    <xsl:if test="$generate.id.attributes != 0">
      <xsl:attribute name="id">
        <xsl:call-template name="object.id"/>
      </xsl:attribute>
    </xsl:if>
    <xsl:call-template name="book.titlepage"/>

    <xsl:apply-templates select="dedication" 
                         mode="dedication"/>
    <xsl:apply-templates select="acknowledgements"
                         mode="acknowledgements"/>

    <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:call-template name="make.lots">
      <xsl:with-param name="toc.params" select="$toc.params"/>
      <xsl:with-param name="toc">
        <xsl:call-template name="division.toc">
          <xsl:with-param name="toc.title.p"
                          select="contains($toc.params, 'title')"/>
        </xsl:call-template>
      </xsl:with-param>
    </xsl:call-template>

    <xsl:apply-templates/>
  </div>
</xsl:template>
-------------------------------------------

The "make.lots" is the part that makes the TOC and the
xsl:apply-templates handles the rest of the book. Copy this template
into your customization layer and switch the two. Or in other words:
insert the xsl:apply-templates first and then the make.lots.

I think this should do the trick, but that's just a quick look. Hope
this helps.

Good luck! :)


--- References
[1] http://sagehill.net/docbookxsl/CustomMethods.html#WriteCustomization
[2]
http://doccookbook.sourceforge.net/html/en/DoCookBook.html#dbc.common.dbcustomize

-- 
Gruß/Regards,
    Thomas Schraitle


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]