[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Finding which template, formatting part of a ToC
Hi folksOn a hunt for which template I need to tweak for a table of contents in an article. A clue or two from someone more expert would help!
Context is, I've got an old copy of oXygen, and I use some slightly-customised XSL to convert DocBook 5 to HTML, for blog posts.
I haven't needed to change any of the XSL for some years now, so I'd semi-forgotten what I used to know about that when I set it up - which even at the time was not a huge amount - but have re-reminded myself of some, by re-reading bits of Bob's book and posts I made to the lists at the time :-)
Today's problem:When writing articles, usually I've used <section>. Now I've added <section> within <section>.
In the auto-generated HTML table of contents, the layout now isn't quite right - it's adding some line breaks I don't want, and losing the font size part way through.
So I thought I'd get into the template and see what it's doing, and see if I can work out how to adjust it to my liking.
Step 1, find out which template is doing that bit!The post-transform HTML contains some <dd> tags to create an indent for the lower-level sections, which seems like it could be a clue as to what the relevant bit of XSL will look like when I find it. So I tried searching on <dd>. But it turns out <dd> appears in quite a lot of the XSL files, so that's not enough of a clue for me to work out which one :-)
I do know which template is _calling_ the bit I'm interested in: <xsl:template name="make.toc">It sets up the "outer layer" of the ToC, and it's in an already-slightly-customised file for ToCs which is an adaptation of, I think, autotoc.xsl.
By looking at this previously-customised make.toc, and sticking in some dummy classes to see what appeared where in the HTML, I was able to deduce that the part of it that's actually doing the work (in this case) is this:
<xsl:otherwise> <xsl:if test="$nodes"> <p class="toc"> <xsl:copy-of select="$toc.title"/> <xsl:apply-templates select="$nodes" mode="toc"> <xsl:with-param name="toc-context" select="$toc-context"/> </xsl:apply-templates> </p> </xsl:if> </xsl:otherwise>If I understand correctly, apply-templates is what tells the middle bit of the ToC to be assembled by a different template somewhere else, or several different templates.
I get that the with-param tag is passing a variable through to the other templates.
select="$nodes" mode="toc" is unfamiliar to me, I'm not sure what that's doing.
Logically, I assume that somewhere along the way, as well as creating the layout of the list, it's also taking the <title> and the xml:id of each <section>, and using those to assemble a link. That bit of transformation could be happening in a different template from the one I need to tweak, though.
Any clues about finding it? Thanks! Jennifer -- www.uncharted-worlds.org/blog/ www.single-bass.co.uk/what-is-single-bass www.single-bass.co.uk/songs