Jack J. Woehr is an independent consultant and team mentor practicing in Colorado. He can be contacted at http://www.softwoehr.com/.
XML Publishing with AxKit
Kip Hampton
O'Reilly Media, 2004
216 pp., $29.95
ISBN 0596002165
XML Publishing with AxKit covers a new Perl CPAN tool that manages, collates, and transforms XML to output specs; for example, HTML, PDF, and the like. It's conceptually a generalization or factor of something like DocBook. It's useful and useable to the Perl CGI programmer, to the technical writer, and to the staff programmer at a publishing house.
Author Kip Hampton does a reasonably good job of identifying the niche and a better job of taxonomizing AxKit itself. Rather than burble 1990's-style about the wonders of XML, I would have started the book, "If you need XML transforms and you're surfeited with Java..." because that is the case here. Nothing that AxKit does in the field of XML transforms is left undone by Java, and that which is done in Java is done by more programmers using more mature tools than AxKit. But since many, if not most, programmers are surfeited with Java, they would have read on anyway.
XML Publishing with AxKit hyperbolically asserts that AxKit "turns Apache into an XML publishing and application server." There's a lot more to application serving than publishing transforms. The management of transactional data objects is the crux of most or all real-world web applications and the subject matter of most application-server XML. AxKit provides no data object facilities of the sort that Enterprise Java does. The AxKit enthusiast, having built the cart first, may turn to Perl DBI and discover that there is insufficient horsepower for high-volume, real-time transaction processing. Not that such things aren't done in Perl, but the Perl programmer doing transaction processing will usually spend a higher percentage of his/her time writing functions as opposed to describing data objects than will an Enterprise Java programmer. Perl programmers are largely those who prefer functional to declarative programming, so I'm probably worrying about nothing.
AxKit, like all modern toolsespecially Perl CPAN toolsis primarily a pipeline of other tools. As with other such pipelines, extensibility and integration with tools such as XPathScript is its strength. However, AxKit is also very much a work in progress. AxKit doesn't support Apache 2, nor does it support recent versions of libxml2. Nonetheless, if you're bound and committed to doing it in Perl (whatever "it" is), then AxKit, or what AxKit becomes when it is more fully developed by its creators and maintainers, is the way to do it. It's a timely and clever idea that brings sophisticated programmatic XML transformations within reach of the scripter.
The book has the potential to baffle the less experienced user at installation time, to baffle them to the point of never completing the installation of AxKit. It took me about six hours of fiddling around to install AxKit completely and get it running. Among the problems were:
- Difficulty building prerequisites via the AxKit install.
- Version problems with libxml2.
- Having to manually modify XML::LibXML Version 1.58's perl-libxml-mm.c (creating a { block } to enclose the declaring and accessing of the local variable xmlChar *, decoded starting at line 968) to get it to compile: Classic C doesn't allow bare variable declarations except at the top of a function.
- The book incorrectly (or outdatedly) indicates that the sample configuration file provided with AxKit is examples/example.conf, which does not exist. Currently, there is only the file demo/axkit.conf to be included from Apache's httpd.conf, and an .htaccess file provided by AxKit that provides other hints to the server.
It's true that I'm not sitting in front of the latest-and-greatest canned Linux release: I'm maintaining my own rich, variegated, and mature open-source software toolchain on Solaris 9. It's not an exotic environment, nor is it in any way hostile to open-source development or Perl. One surmises that the author, while writing this book sitting in front of an ideal platform optimized for AxKit, either neglected to mention the sorts of problems that ordinary users might encounter or shrugged them off as endemic to the CPAN approach, where modules can change asynchronously with respect to both underlying compiled libraries and companion modules.
The best procedure for building a minimally useful AxKit is as follows:
- Download, configure, build, and install (or make sure you already have) Perl 5.8.x.
- Download, configure, build, and install libxml2 Version 2.6.8 (http://xmlsoft.org/).
- Download, configure, build, and install libxslt (http://xmlsoft .org/), which is apparently not version sensitive.
- Use the Perl cpan tool to install Apache::Test and Error (if you have not already done so).
- Use the Perl cpan tool to install XML::LibXML and XML::LibXSLT.
- Use the Perl cpan tool to install AxKit.
If, in the course of the build, you discover that mandatory prerequisites not mentioned above are missing, the easiest and most reliable procedure is to control-C out of cpan, and restart and install the prerequisite directly, rather than allowing the cpan tool to chain multiple prerequisite builds. Build chaining is a nice feature of the cpan tool, only it doesn't always work well, and it works spectactularly poorly in the AxKit build.
The web site for the book is http://www.oreilly.com/catalog/ xmlaxkit/ where the usual table of contents, sample chapter, and errata can be found. As of this writing, none of the example code from the book is provided.
TPJ