
The first two parts of this tutorial explained how to generate static HTML web pages from XML sources. With a little help from an XSLT processor these target documents were more or less easily produced. To convert XML to HTML dynamically just takes a little bit of time on the server side.
Mainly two software packages offer this functionality without a frightening price-tag: the Java-based Apache project Cocoon, currently available as version 1.8, and the Perl module AxKit, developed by Matt Sergeant, currently available as version 1.2. Both are free of cost, something you can't possibly say about most of the application servers (although there are a few open source projects).
iX has mentioned Cocoon in an earlier article (see [1]); an article on a more recent version will be published soon. This part of the tutorial deals with the "XML delivery toolkit" AxKit - as Rael Dornfest has put it. More precisely, it deals with how web surfers click on an XML document (e. g. xml.heise.de/ix/xslt/brief.xml) and receive dynamically generated HTML on their browsers. In order to achieve this, AxKit has to be incorporated in the Perl hierarchy of the web server. Knowledgeable Perl persons know the procedure by heart.
perl Makefile.PL make make test make install
Here, the last step requires you to have superuser rights, because installing implies writing files to directories like /usr/lib/perl5. Complications possibly arising during the process are described in a separate article, which, alas, is only available in German (see [2]). Provided, the installation was successful, the next item on the to-do-list is to extend the Apache configuration, because AxKit works via mod_perl directly with Apache. Within the configuration file httpd.conf the web mistress can set one or several cache directories, make sure that a certain character set is used in the output (if anything apart from UTF-8 is wished for), and set options for different files and directories. Listing 1 shows a sample entry in httpd.conf (as used for this article), which sets AxKit as the PerlHandler for the directory /xslt, defines ISO-Latin1 as the character set of the output, sets a cache directory and activates two different Perl modules for two different kinds of files.
text/xsl is meant to be for mere XSLT processing, which Sablot is going to be in charge of. application/x-xpathscript stands for XPathScript, a scripting language developed by Matt Sergeant, and defines the module of the same name as the handler of such files (e. g. file.xsp). But first let's deal with pure XSLT.
Literature
[2] Stefan Mintert; ; Serving XML; XML-Daten ins WWW liefern; iX 10/1999, S. 178
[4] Henning Behme; ; Modularie; Mit dem Perl-Modul AxKit arbeiten; iX 3/2001, S. 98
| iX-TRACT |
|
Dieser Text ist der Zeitschriften-Ausgabe 03/2001 von iX entnommen.
Parallelprogrammierung - die Kunst der Multi-Core-Nutzung
Agile ALM - agile Praktiken im Application Lifecycle Management
Webentwicklung - Applikationen für mobile Clients