![]() |
|
AxKit Quickstart GuideKip Hampton
This document is a quick start guide designed to help developers deliver transformed XML with AxKit as quickly as possible. As such, many of the finer points of AxKit's extremely robust interface will not be covered. For a more descriptive introduction, please see Matt's Introduction to AxKit [1].
Installing and Configuring AxKitThis guide presumes that you already have an Apache [2] httpd server running mod_perl [3]. If this is not the case, please visit the Apache [2] and mod_perl [3] pages for more information. Step 1 - Download and Install AxKit
First, visit the AxKit
download directory [4] and grab the latest tarball. Once you've
downloaded the source, type the following:
Step 2 - Edit Your httpd.conf File
Add the following lines to your httpd.conf:
Don't worry that this looks like AxKit will deliver all of your files, if it doesn't detect XML at the URL you give it, it will let the httpd deliver it as normal. If you're still concerned, put all but the first configuration directive in a <Location> [5] section. Note that the first line: PerlModule AxKit MUST occur in your httpd.conf so that it is parsed in the parent httpd process. This is because it adds configuration directives to the entire Apache httpd. If you do not do this you will get SEGFAULTs. Now, stop and restart your Apache server and assuming you've had no trouble with the steps above, you are now ready to begin publishing transformed XML with AxKit! Installing the Sablotron XSLT Processor (Optional)This section assumes that you will be installing the Sablotron XSLT processor along with AxKit. If you want to see AxKit in action but do not want to install Sablotron you may safely skip to the next section [6]. Step 1 - Download and Install the Sablotron XSLT ProcessorNext, fetch either the source or appropriate binary distribution of the Sablotron XSLT Processor from www.gingerall.com [7]. As of version 0.50, Sablotron requires the shared library version of the Expat XML parser to be installed before installing Sablotron. Visit the Expat project page [8] for sources and installation instructions.
Installing Sablotron from the source:
Step 2 - Install the XML::Sablotron Perl Library
Next, install XML::Sablotron. You can either install the package by hand or use the CPAN
shell. To install using the CPAN shell type:
Sample Document TransformationsNow, we're going to see how AxKit works by transforming an XML file containing data about Camelids (note the dubious Perl reference) into HTML. Step 1 - A Sample XML Document
First, you will need a sample XML file. Open the text editor of your choice
and type the following:
Step 2 - Create a StylesheetNow, create the stylesheet to transform your XML document. If you have chosen to install Sablotron or one of the other XSLT processors that AxKit supports you may use either the XSLT or XPathScript samples below. If you have not installed an XSLT processor skip directly to the XPathScript example. Using XSLT
Start a new file and type the following:
Using XPathScript
Create a new file and type:
Step 3 - Associate the XML Document with your Stylesheet
Next, re-open the test.xml file and add the following just after the <?xml version="1.0"?>
declaration. If you have selected the XSLT example, add:
Step 4 - Finishing UpYou are now ready to deliver your little zoological XML data file as formatted HTML! Just copy or move the XML and stylesheet files into the same directory under your httpd DocumentRoot. Then, point your browser to http://your-server.com/path/to/test.xml and you should see your data nicely formatted in an HTML table. Congratulations, you are now well on the road to adding XML, XSLT, XPathScript and AxKit to your developmental toolbelt. For more information about AxKit's advanced features, please visit the AxKit homepage [9]. If Things Go WrongAs I stated in the introduction, this is document is designed to walk someone through the AxKit instalation process, on to serving transformed documents as quickly and simply as possible. Depending upon your setup, installing AxKit may require some special attention to get it to sanely co-exist with some of the other tools that you may be using. If you've had any trouble while following the steps outlined here, please consult the AxKit FAQ [10], and the AxKit User's mailing list archives [11]. Other Resourcesmod_perl
XSLT
XPathScript
List of Links
|