mod_xml

mod_xml is an application framework for XML applications and Webservices to run withing the Apache 2.0 webserver. mod_xml is hosted at Sourceforge (http://mod-xml.sourceforge.net/), but that didn't succeed in giving it the momentum I had originally hoped. I have found working with sourceforge challenging (not least due to the inordinately slow speed of CVS over a modem link), so I am moving some related material back to WebÞing.

Modularisation of mod_xml

My recent work with mod_xml has divided it into smaller modules:

  1. mod_xml_in - input filters for XML applications.
  2. XML Handlers mod_xml_gnome (libxml2) and mod_xml_apache (Xerces-C)
  3. XSLT Filters mod_xml_gnome_xslt (libxslt) and mod_xml_apache_xslt (Xalan-C)

This modularisation reduces size and complexity of mod_xml, and meets my own need to run both gnome-based and apache-based applications on the same server more cleanly than the monolithic module.

mod_transform

An XSLT filter, mod_xml_gnome_xslt, is the only mod_xml component that went beyond experimental use. It has now been stable for more than two years. In early 2004, development work on it was resumed outside WebÞing. We are now happy to recommend mod_transform as successor to this. mod_transform aims to make it more general-purpose, and adds new capabilities including support for XIncludes.

mod_xml_gnome_xslt

mod_xml_gnome_xslt is the only component that's really mature and stable enough to publish as a separate module. It is an XSLT filter providing both "normal" XSLT and the optimisations developed for mod_xml:

Configuration

As with any filter module, the basic directives to invoke it are SetOutputFilter and AddOutputFilter. Two new configuration directives are supplied:

modxmlGnomeXSLTSet
Specifies an XSLT stylesheet to be used. If present, it overrides any processing instruction (PI) in the XML.
modxmlGnomeXSLTCache
Load and pre-compile a stylesheet at server startup. This directive takes two arguments: the stylesheet URL, and a local pathname to the file on the server.

In addition, two functions are exported for use by other modules:

void modxmlGnomeSetXSLT(request_rec* r, const char* name)
This is a programmatic equivalent to modxmlGnomeXSLTSet
void modxmlGnomeXSLTDoc(request_rec* r, xmlDocPtr doc)
Pass in an in-memory document tree. Handlers using this should not write any output by the normal means, as it will then be ignored and give rise to a memory leak.

mod_xml_gnome_xslt.c is available under the GNU General Public License (GPL). See also GnomeXSLT.h, the header file for other modules using this module programmatically.