AxKit - an XML Delivery Toolkit for Apache
AxKit provides the user with an application development environment for mod_perl, using XML, Stylesheets and a few other tricks. See http://xml.sergeant.org/axkit/ for details.
In httpd.conf:
PerlModule AxKit
Then in any Apache configuration section (Files, Location, Directory, .htaccess):
# Install AxKit main parts SetHandler perl-script PerlHandler AxKit # Setup style type mappings AxAddStyleMap text/xsl Apache::AxKit::Language::Sablot AxAddStyleMap application/x-xpathscript \ Apache:AxKit::Language::XPathScript # Optionally setup a default style mapping AxAddDefaultStyleMap /default.xsl text/xsl # Optionally set a hard coded cache directory AxCacheDir /opt/axkit/cachedir
Now simply create xml files with stylesheet declarations:
<?xml version="1.0"?> <?xml-stylesheet href="test.xsl" type="text/xsl"?> <test> This is my test XML file. </test>
And for the above, create a stylesheet in the same directory as the file called "test.xsl" that compiles the XML into something usable by the browser. If you wish to use other languages than XSLT, you can, provided a module exists for that language.
If you have trouble compiling AxKit, or apache fails to start after installing, it's possible to use AxKit without the built in configuration directives (which have been known to generate segfaults). To do this install as follows:
perl Makefile.PL NO_DIRECTIVES=1 make make test make install
This removes the custom configuration directives. Note that you may have to manually remove old AxKit.pm files from your perl library directory if you have previously built it, because dynamically built libraries go into the i386 (or whatever processor you have) directory. Now you can change the directives to ordinary PerlSetVar directives:
PerlSetVar AxStyleMap "text/xsl => Apache::AxKit::Language::XSLT, \ application/x-xpathscript => Apache::AxKit::Language::XPathScript" # note brackets here PerlSetVar AxDefaultStyleMap "(/default.xsl text/xsl) \ (/other.xsl text/xsl)" PerlSetVar AxCacheDir /opt/axkit/cache
It's worth noting that the PerlSetVar option is available regardless of whether you compile with NO_DIRECTIVES set, although it is marginally slower to use PerlSetVar.
To install AxKit, copy and paste the appropriate command in to your terminal.
cpanm
cpanm AxKit
CPAN shell
perl -MCPAN -e shell install AxKit
For more information on module installation, please visit the detailed CPAN module installation guide.