Re: [docbook-apps] Finding which template, formatting part of a ToC
hi Bob & everyone Can you tell me what version of DocBook XSL your customization is based on? The element was replaced by quite awhile ago. Looks as though it's from 2007! But also, I'm pretty sure that switching the to a was something I did myself when I was customising it. (for simplicity of HTML when pasting into WordPress - it's worked neatly while I'd only had one layer of .) (I know my software is rather "stuck in the past" - I don't use this setup often enough to feel I can justify paying for another version of oXygen, and luckily the old one still works, so nothing's prompted me to upgrade.) Thanks for the explanation of how ToCs are put together - this is very helpful! I remember I did wonder whether there might be an interim variable stashed somewhere as part of the automation, so it makes sense, and now I am having that nice feeling of "ohhh the light dawns" :-) now let's see how I get on with actually tweaking it :-) Jennifer -- www.uncharted-worlds.org/blog/ www.single-bass.co.uk/what-is-single-bass www.single-bass.co.uk/songs - To unsubscribe, e-mail: docbook-apps-unsubscr...@lists.oasis-open.org For additional commands, e-mail: docbook-apps-h...@lists.oasis-open.org
Re: [docbook-apps] Finding which template, formatting part of a ToC
Hi Jennifer, Can you tell me what version of DocBook XSL your customization is based on? The element was replaced by quite awhile ago. In general, the way it works is that the document is processed again in mode="toc". Instead of the normal processing of an element to format its content, the mode="toc" processes the element to generate just an entry in the TOC for that element by formatting its title inside an link whose @href points to that element's content. You'll find in html/autotoc.xsl a set of templates matching on different elements and with the attribute mode="toc", such as this one: The $nodes parameter is a list of the children of the current element that should be included as a sublist under that element's TOC line. The template that does all the work is named "subtoc". It is in subtoc where you will find the code that generates a line in the TOC: The order of processing in subtoc is a bit confusing, because it processes the children first into a temporary subtoc.list variable, then outputs the TOC line followed by that subtoc list variable. The handling of has always been a bit inconsistent across browser versions. In more recent versions of the stylesheet there is a stylesheet param named 'toc.list.type' which lets you replace with . You can use CSS to turn off the bullets for the list. Does your version of html/autotoc.xsl have a line like this: If so, then you can replace , which might solve some of your formatting problem. Bob Stayton b...@sagehill.net On 6/30/2020 10:38 AM, Jennifer Moore wrote: Hi folks On 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 . Now I've added within . 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 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 . But it turns out 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: 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: 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 and the xml:id of each , 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
[docbook-apps] Finding which template, formatting part of a ToC
Hi folks On 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 . Now I've added within . 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 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 . But it turns out 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: 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: 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 and the xml:id of each , 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 - To unsubscribe, e-mail: docbook-apps-unsubscr...@lists.oasis-open.org For additional commands, e-mail: docbook-apps-h...@lists.oasis-open.org