Request for Help
Nov. 20th, 2007 01:48 pmDoes anyone have any experience of using DocBook ? I'm having a bit of a nightmare with it, and am fast coming to the conclusion that the thing I want to do can't easily be done.
I'm writing a series of pages, which will be (eventually) grouped loosely together. I've written each as an <article> - which means that, by default, the DocBook XSLT transform generates a table of contents for each page.
To get round this, I've been adding a lt;suppresstoc> element, which my XSL style sheet does this with:
<xsl:template match="suppresstoc">
<xsl:param name="generate.toc">
article nop
</xsl:param>
<xsl:apply-templates />
</xsl:template>
(I'm happy to believe this is quite The Wrong Thing, suggestions welcome.)
This works, so long as you don't do anything dangerous like trying to validate your XML. If you do, it complains quite reasonably that it doesn't know anything about this <suppresstoc> element.
I've tried adding the element in this manner:
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"[
<!ELEMENT suppresstoc (sect1)>
]<
But xmllint is having none of it... because the DocBook DTD maintains that the article document goes:
<article>
<articleinfo>
...
</articleinfo>
<sect1>
... with no content before the sect1, except for the articleinfo. I can't find anywhere to put the suppresstoc tag such that it doesn't violate the DocBook DTD.
So... I'm keen not to modify the DTD because (a) what I know about DTDs/XML/xslt fits conveniently on a very small stamp and (b) it's just easier to refer to the standard one, and saves us maintenance bother. Is there anyway I can define an element which does what I want in a conformant way ?
Even better, is there a standard way of suppressing the ToC which would avoid all this bother in the first place ?
I'm writing a series of pages, which will be (eventually) grouped loosely together. I've written each as an <article> - which means that, by default, the DocBook XSLT transform generates a table of contents for each page.
To get round this, I've been adding a lt;suppresstoc> element, which my XSL style sheet does this with:
<xsl:template match="suppresstoc">
<xsl:param name="generate.toc">
article nop
</xsl:param>
<xsl:apply-templates />
</xsl:template>
(I'm happy to believe this is quite The Wrong Thing, suggestions welcome.)
This works, so long as you don't do anything dangerous like trying to validate your XML. If you do, it complains quite reasonably that it doesn't know anything about this <suppresstoc> element.
I've tried adding the element in this manner:
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"[
<!ELEMENT suppresstoc (sect1)>
]<
But xmllint is having none of it... because the DocBook DTD maintains that the article document goes:
<article>
<articleinfo>
...
</articleinfo>
<sect1>
... with no content before the sect1, except for the articleinfo. I can't find anywhere to put the suppresstoc tag such that it doesn't violate the DocBook DTD.
So... I'm keen not to modify the DTD because (a) what I know about DTDs/XML/xslt fits conveniently on a very small stamp and (b) it's just easier to refer to the standard one, and saves us maintenance bother. Is there anyway I can define an element which does what I want in a conformant way ?
Even better, is there a standard way of suppressing the ToC which would avoid all this bother in the first place ?
no subject
Date: 2007-11-21 11:35 am (UTC)I think my current system is probably the least dangerous approach, but I'm curious to know more about the whole business. Maybe I should just corner you for an hour when you're back for Christmas :)