← Prev in month ← Prev in thread

Adding an ID attribute to HTML output

From
Tom Dobbs <>
Date
2010-06-14T21:25:45+00:00
ID
Thread
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="foo/bar/things/Overview.html">Overview</a></span>

	<ul>

		<li><span class="sect2"><a id="KeyFeatures" href="foo/bar/things/KeyFeatures.html">Key Features</a></span></li>

		<li><span class="sect2"><a id="sample" href="applications/sample.html">Sample</a></span></li>

	</ul>

...

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 that docbook-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?

-Tom Dobbs
← Prev in month ← Prev in thread