----- Original Message -----
Sent: Monday, June 14, 2010 2:25 PM
Subject: [docbook-apps] Adding an ID attribute to HTML output
I'm trying to add an ID attribute to DocBook's HTML TOC generation, like this:
<span class="sect1"><a id="Overview" href="x-msg://15/foo/bar/things/Overview.html">Overview</a></span>
<li><span class="sect2"><a id="KeyFeatures" href="x-msg://15/foo/bar/things/KeyFeatures.html">Key Features</a></span></li>
<li><span class="sect2"><a id="sample" href="x-msg://15/applications/sample.html">Sample</a></span></li>
The ID value is simply taken from the xml:id value of the respective XML source tag
I need a nudge in the right direction. When I take a peek inside the DocBook dragon, er, rather, collection of .xsl files, I find thatdocbook-xsl-ns-1.75.1/html/autotoc.xsl in the html folder seems to be responsible for the TOC generation. I also see that line 318* right after the <span> nicely adds a class name to the enclosing span such that <span class="sect1"> and so forth is written.
*<xsl:attribute name="class"><xsl:value-of select="local-name(.)"/></xsl:attribute>
I am guessing that if I add a similar line right after the subsequent <a>, I can get what I'm after. Something like:
<xsl:attribute name="id"><xsl:value-of select="???"/></xsl:attribute>
But my question is, what do I add in for ???
And my other question is, is there a way to handle this in the customization layer?