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] Adding author name to TOC

Hi Jason,
You will want to copy the template named 'toc.line' from html/autotoc.xsl to your customization layer and modify it to add author.  This line of XSL generates the title:
        <xsl:apply-templates select="." mode="titleabbrev.markup"/>
The context node for that template is the element for that line in a TOC (chapter, section, etc.).  So you would want to add an xsl:if statement after the title to include the author, something like this for DocBook 5 (remove the d: namespace prefix if DocBook 4):
<xsl:if test="(self::d:chapter or self::d:article) and d:info/d:author">
  <xsl:text> </xsl:text>
  <span class="tocauthor">
    <xsl:variable name="author">
      <xsl:apply-templates select="d:info/d:author[1]" mode="titlepage.mode"/>
    <xsl:value-of select="$author"/>
The $author variable is used to strip any formatting that would be applied by titlepage.mode using xsl:value-of, which returns only text.
You can add a CSS selector matching on class 'tocauthor' to format the author name in the TOC.
Bob Stayton
Sagehill Enterprises
----- Original Message -----
From: Jason Zech
Sent: Wednesday, June 01, 2011 9:20 AM
Subject: [docbook-apps] Adding author name to TOC



Is there a relatively simple way to customize the TOC generation so that the author name is included with the chapter/article title in the TOC for HTML output? I am working a on book of pieces by dozens of authors and would like to include the author names in the TOC without having to manually generate the TOC (if possible).





Jason Zech | Project Manager, Digital Workflow | New Product Development
[ph] 773-281-1818 x212   [fax] 773-281-4129 | zech@loyolapress.com

LoyolaPress. | A Jesuit Ministry
3441 N. Ashland Ave. | Chicago, IL 60657 | www.loyolapress.com
Join our online community of advisors: www.SpiritedTalk.org


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