[Techtalk] how to read an XML-tagged file

Wolfgang Petzold petzold at villa-chaos.de
Sun Aug 8 10:52:41 EST 2004


Hello!

> I have this nice XML-tagged file, and I don't know to read it formatted- help 
> please. The formatting does not work in a Web browser, or in Open Office. 
> Here's the headers:
> 
> <?xml version="1.0"?><!-- -*-XML-*- -->
> 
> <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
>           "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">

Yes, it's DocBook XML. It is used for (technichal) documentation, and
you can generate various output formats from it -- like HTML or PDF for
instance.

If you only want to read a formatted copy of the one document you got
I'd suggest to look at the place where you got it from if there are
formatted versions available for download (if that is applicable).
Otherwise you will have to do the generation part by yourself which I
personally found to be a bit tricky.

In short, you have to install some packages, like (debian-speak)

	docbook-xml (the dtd files)
	docbook-xsl (the stylesheets needed for the generation part)
	xsltproc    (a processor that can generate e.g. HTML from DocBook)

and the ones they depend upon, of course. There are some tutorials on
setting up a docbook XML toolchain on the web, some of which I found
more useful (and others less). Try "googling" for them. Also,
the online readable book "Docbook--The definitive Guide" at
http://www.docbook.org/  might be a starting point.

Once you have all the tools setup properly, a command like

$ xsltproc -o output-folder/ /path/to/docbook-xsl/html/chunk.xsl
your-document.xml

should be able to generate a set of formatted HTML pages (perhaps only
one page) from your document source.

Wolfgang


More information about the Techtalk mailing list