Doxygen and DocBook

In the previous article I explained how to create a PDF file from DocBook XML. One big advantage of using XML is that you can easily connect it to other sources.

To integrate documentation produced by Doxygen from your source files tell Doxygen to produce XML output (get it via MacPorts - "port install doxygen"):

/opt/local/bin/doxygen doxygen.config

where GENERATE_XML = YES is set in your doxygen.config.

The next step uses xsltproc which you also get via MacPorts ("port install libxslt"). The many XML files have to be merged into one:

/opt/local/bin/xsltproc --output DoxygenCompound.xml combine.xslt index.xml

In order to use the single Doxygen XML file (DoxygenCompound.xml) you need to translate it to a valid DocBook file:

/opt/local/bin/xsltproc --output DocBookChapter.xml Doxygen2Docbook.xsl DoxygenCompound.xml

The Doxygen2Docbook.xsl was written by me and probably needs to be adapted to match your needs. Finally reference the resulting DocBookChapter.xml in your main DocBook file:

    <xi:include href="DocBookChapter.xml"/>

Be aware that xsltproc is currently not able to process the <xi:include> element so you better produce one merged XML file and let Xalan output the XSL-FO file (see previous article):

/opt/local/bin/xmllint --nonet --xinclude --output DocumentationIncluded.xml Documentation.xml