DocBook Publishing - Output to HTML
I learned about DocBook last year and found it a great tool for technical documentation. It is a XML based semantic markup language. The DocBook is originally intended for computer hardware and software documentation but it is great for other documentation purposes.
I have been working on some documentation, new and converting existing from Lyx to DocBook. With DocBook, I am able to publish the contents easily to many formats, namely TEX, text, pdf or HTML. I had been trying to output some of my DocBook documentation to HTML.
This afternoon, I have finally succeeded to publish to HTML. I installed some DocBook packages on Ubuntu. Here are the packages you need to get DocBook going:
- docbook
- docbook-xsl
- docbook-xsl-doc
- docbook-xsl-doc-html
- docbook-xsl-doc-pdf
- docbook-xsl-doc-text
- xsltproc
- and optional xalan and fop
To output your DocBook document to HTML, simply this:
$ xsltproc --output paper.html \
/usr/share/xml/docbook/stylesheet/nwalsh/xhtml/docbook.xsl\
paper.xml
You can turn on chapter and section numbering by setting chapter.autolabel to 1 and section.autolabel to 1. To include the chapter number in every sections, set section.label.includes.component.label to 1.
$ xsltproc --output paper.html \
--stringparam section.autolabel 1 \
--stringparam section.label.includes.component.label 1 \
/usr/share/xml/docbook/stylesheet/nwalsh/xhtml/docbook.xsl \
paper.xml
Comments
3 Responses to “DocBook Publishing - Output to HTML”
Leave a Reply


Listen to my podcast
I haven’t yet tested whether the things downloaded
allows me to create Docbook documents (I will be using lyx to do this and haven’t gotten docbook to
work with lyx yet.
However I did run into some downloading problems:
1) I assume “docbook-xsl-doc-pd” is really:
“docbook-xsl-doc-pdf”
2) installing both “docbook-xsl-doc-pdf” and “docbook-xsl-doc-text” reported errors about overwriting
files already created when “docbook-xsl-doc-pdf”
was installed.
The synaptic package manager never found any
“fop” to install.
I am running Ubuntu hardy on a vanilla PC.
Thanks for the web site. It’s a big help.
Ralph Boland
Yes. It is “docbook-xsl-doc-pdf”. It was a typo and thanks for spotting.
You can find package “fop” at Docbook site. It is not included in Ubuntu distribution.
You will need a XML editor to create your documents. Then you use xsltproc to generate required output.
Hope that helps.
Thanks for the tips. I am able to output to html but not pdf. Do I need fop package to output to pdf? Perhaps I have overlook, I can’t find fop.