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] ToC in ToC, how?


Yes, this is possible by customizing the templates in fo/autotoc.xsl.

First you need to include the figure, table, example elements in the 
selection under a toc item.  Each element is processed in mode="toc" and 
selects its subitems after formatting its line with the 'toc.line' 
template. For example, in the template starting with:

<xsl:template match="section" mode="toc">

you will find these lines that select a section entry's children to include 
under it:

        <xsl:apply-templates select="section" mode="toc">
          <xsl:with-param name="toc-context" select="$toc-context"/>
        </xsl:apply-templates>

Change the select to:

select="section|figure|table|example"

That will add figure, table, and example entries in document order under 
the section title.  Do the same for the template matching on chapter (and 
other elements) in mode="toc" to get any figures that appear before the 
first section.

But that isn't enough.  The standard format in a LOT is to just display the 
number and title, and not the word "Figure" or "Table", so you won't be 
able to tell which is which in the output.  You'll need to customize the 
template named 'toc.line' to change the content of <xsl:variable 
name="label"> to include the element type before the number:

  <xsl:variable name="label">
    <xsl:choose>
      <xsl:when test="self::figure">
        <xsl:text>Figure </xsl:text>
      </xsl:when>
      <xsl:when test="self::example">
        <xsl:text>Example </xsl:text>
      </xsl:when>
      <xsl:when test="self::table">
        <xsl:text>Table </xsl:text>
      </xsl:when>
    </xsl:choose>
    <xsl:apply-templates select="." mode="label.markup"/>
  </xsl:variable>

This is an English-only way of adding the element label.  If you need it to 
work with many languages, then you would need to replace the <xsl:text> 
elements with a call to the 'gentext' template (see elsewhere in 
autotoc.xsl for an example of that).

Bob Stayton
Sagehill Enterprises
DocBook Consulting
bobs@sagehill.net


----- Original Message ----- 
From: "Kebang Lin" <link0000@yahoo.com>
To: <docbook-apps@lists.oasis-open.org>
Sent: Tuesday, August 22, 2006 7:32 AM
Subject: [docbook-apps] ToC in ToC, how?


> Hi,
>
> I sent this message to the group a couple of days ago, but got no reply. 
> That means the question was either really dumm or really hard. Or was it 
> because I didn't put a subject line?
>
> Anyway, I decide to pose the question again, and hope to grab the 
> attention this time.
>
> I'm trying to format a DocBook document using DocBook-XSL-1.70.1 as 
> basis. I want to generate PDF document using Xalan + Xep (I can't make 
> FOP 0.92beta to work).
>
> Now, it is required that the TOC include both TOC and LOT entries (with 
> page numbering in roman numerals) in a specific order. I went through the 
> DocBook XSL: The Complete Guide, but couldn't find a way to do it.
>
> Is it doable? If yes, how? Maybe I have to manually insert those entries 
> into the *.fo file?
>
> Thanks a lot!
>
> Kebang Lin
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
> For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
> For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org
>
>
> 




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