|
List Info
Thread: Customizing table of contents in HTML output
|
|
| Customizing table of contents in HTML
output |

|
2006-10-30 16:04:05 |
|
Camille,
No, I didn't intend to respond only to you. I simply forgot to CC the mailing list.
Below is the solution I came up with, thanks to your help:
<xsl:template match="part"> <h2><xsl:value-of select="title"/></h2>
<table class="toc"> <tr> <td><strong>DOCUMENT</strong><hr /></td> <td><strong>REVISION</strong><hr /></td>
</tr> <xsl:for-each select="chapter"> <tr> <td><a> <xsl:attribute name="href"> <xsl:call-template name="
href.target"> <xsl:with-param name="object" select="."/> </xsl:call-template> </xsl:attribute> <xsl:value-of select="chapterinfo/title"/>
</a></td> <td><xsl:value-of
select="chapterinfo/revhistory/revision[position()=last()]/revnumber"/></td> </tr> </xsl:for-each> </table> <xsl:apply-templates/> </xsl:template>
This allows me to make a separate HTML table for each DocBook Part. Each table has two columns, the first of which lists the Title of the document (and since I am chunking the output, this field is hyperlinked), and the second lists the last RevNumber.
- Colin
On 10/26/06, Camille Bégnis < camille neodoc.biz">camille neodoc.biz> wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
[Was this meant to my eyes only? You can forward answer to list if useful]
Hi Colin,
Oh OK sorry I misunderstood.
This is the template you might try, adapt the "match" value depending on
where you want the table to appear in your document
- ------------------------------------------------------------ <xsl:template match="//chapter[1]"> <table> <title>Table of Contents</title>
<tgroup cols="5"> <thead> <row> <entry>DOCUMENT</entry> <entry>REVISION</entry> </row> </thead> <tbody> <xsl:for-each select="//chapter/chapterinfo">
<row> <entry><xsl:apply-templates select="title"/></entry> <entry><xsl:apply-templates select="revhistory/revision[position=last()]/revnumber"/></entry>
</row> </xsl:for-each> </tbody> </tgroup> </table> <xsl:apply-imports> </xsl:template> - ------------------------------------------------------------
Disclaimer: untested 
Camille.
Colin Shapiro a écrit : > Camille, > > Thanks for your input. However, I don't think I made it clear enough > that I'd like my table of contents to be in an actual table format.
> > The example in Bob Stayton's book (which I've looked at before) does > indeed describe how to customize the listitem entries in a table of > contents, but that assumes you'd want to keep the table of contents in
> its standard list form. > > Instead, I want it to be an actual table, like this crude example (which > I realize may look funny in various fonts / email clients, but I think > you'll get the idea):
> > ---------------------------------------------- > | DOCUMENT &nbs | |