Troff to xml tools

There’s a lot of ways to convert troff document to xml, but, unfortunately, no standart way to do it. Thanks to the ux macro, utmac use nroff itself for this task. That solution has the advantage to be easy to implement, and to be troff compliant, since one can use all the troff commands he wants in his document. But to do that well, a pre-processor (prexml) and a post-processor (postxml) are needed, so that the command line is as follow :

prexml f.tr | nroff -Tlocale -mux | postxml > f.xml

The xml file produced this way follow a custom xml format, and some stylesheets convert this custom format to and from html and fodt.

prexml f.tr | nroff -Tlocale -mux | postxml > f.xml
xsltproc utohtml.xsl f.xml > f.html
xsltproc utofodt.xsl f.xml > f.fodt


Documentation and download

See the following files : troffxml, bsd2, readme.

Download troffxml-0.6.tar.gz, troffxml-0.6.md5sum.