You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axkit-dev@xml.apache.org by AxKit Wiki <axkitwiki> on 2004/01/09 01:07:43 UTC

New Wiki Content at AxKitRedHat9AnotherWay

Wiki content at AxKitRedHat9AnotherWay Changed by someone at IP 216.100.134.224 :

@@ -0,0 +1,198 @@
+=head1 AxKit on Red Hat 9, Another Way To Do It
+
+David Nolan, L<vi...@cmu.edu>
+
+=head2 Introduction
+
+Benjamin Boksa wrote a ni0ce page on how to install AxKit on RedHat 9.
+
+However I think those instructions make you do to much.  In particular, 
+RedHat's perl installation works just fine, if you do everything right.
+
+The following document is the procedure I used to install AxKit 1.6.2 on 
+a freshly installed RedHat 9 machine.
+
+=head2 Install RedHat 9
+
+First, install RedHat 9 on your machine.  I won't give you full instructions
+for this, instead I'll just list the primary things to pay attention to.
+
+Don't install RedHat's apache.  RedHat ships Apache 2, and AxKit does not yet
+work with Apache 2.
+
+Be sure to install the libghttp-devel package, otherwise you won't be able to 
+build the HTTP::GHTTP perl module.  And while that modules isn't strictly
+required by AxKit, it does improve performance.
+
+=head2 Change the default system language
+
+After installation is complete, you'll need to change the default language of the system.
+
+For inexplicable reasons, RedHat 9 ships with the default language set to a UTF-8
+based language, which causes perl all sort of problems.
+
+Edit C</etc/sysconfig/i18n> and change the language to C<en_US> or something equivalent not using UTF-8.
+The resulting file should look something like this:
+
+  LANG=en
+  LANGUAGE=en
+  LINGUAS=en_US:en
+  LC_ALL=en_US
+  SUPPORTED="en_US:en"
+  SYSFONT="latarcyrheb-sun16"
+
+After having changed the system language reboot the machine to make sure the new value for LANG is propagated.
+
+=head2 Upgrading the XML libraries
+
+The XML libraries which ship with RedHat 9 have some known issues when used with AxKit.
+Download the latest versions of all these RPMS from L<ftp://xmlsoft.org>.  
+
+  libxml2
+  libxml2-devel
+  libxml2-python
+  libxslt
+  libxslt-devel
+  libxslt-python
+
+The versions I downloaded and installed on my machine were:
+
+  libxml2-2.5.11-1.i386.rpm
+  libxml2-devel-2.5.11-1.i386.rpm
+  libxml2-python-2.5.11-1.i386.rpm
+  libxslt-1.0.33-1.i386.rpm
+  libxslt-devel-1.0.33-1.i386.rpm
+  libxslt-python-1.0.33-1.i386.rpm
+
+Install those rpms, via something like C<rpm -Uhv libxml2*.rpm libxslt*.rpm>
+
+=head2 Install Apache
+
+Download and install the latest Apache, mod_perl, and any other Apache modules you need.
+
+There are too many configuration choices with Apache to go into all of them, but for a simple AxKit machine all you need is Apache and mod_perl.  So here are the simple instructions for just those two packages.
+
+Untar both in the same directory, cd into the mod_perl directory and 
+
+  $ perl Makefile.PL EVERYTHING=1 USE_APACI=1 DYNAMIC=1 DO_HTTPD=1 APACI_ARGS="--enable-module=so 
+    --enable-shared=info --enable-shared=proxy --enable-shared=rewrite   --enable-shared=log_agent"
+
+  $ make
+  $ make install
+
+You'll also need to run C<make install> in the apache directory, as mod_perl doesn't do that for you.
+
+Make sure that the apache bin directory is in your path before moving on to the next step.
+
+=head2 Installing Additional Perl Modules
+
+Before you install AxKit itself, you'll need a bunch of perl modules that RedHat doesn't provide.
+
+I always install these individually before installing AxKit, as letting CPAN handle the dependencies 
+never seems to work right (for me).
+
+We'll do everything from the CPAN shell, so start that up. 
+Run C<perl -MCPAN -e shell>.  If this is your first time in the CPAN shell,
+you'll have to configure CPAN.  
+
+When the CPAN shell is configured run each of these commands in the shell.
+
+  install XML::NamespaceSupport
+  install XML::SAX
+  install XML::LibXML::Common
+  install XML::LibXML
+  install XML::LibXSLT
+  install XML::XPath
+  install Compress::Zlib
+  install Error
+  force install Apache::Test
+  force install Apache::Request
+  install HTTP::GHTTP
+  install Perl::Tidy
+
+The C<force> options for Apache::Test and Apache::Request can be dropped if you go
+through the extra effort to figure out how to make Apache::Test work right.  I never bother.
+
+=head2 Install AxKit
+
+Finally, in the same CPAN shell, you can install AxKit
+
+  force install AxKit
+
+Choose no when prompted about Sablotron.  Again, the C<force> option is because of Apache::Test.
+
+=head2 Enable AxKit
+
+Modify your httpd.conf to enable AxKit.  I add:
+
+  PerlModule AxKit
+  AddHandler axkit .xml .xsp .dkb
+  AxAddStyleMap application/x-xpathscript Apache::AxKit::Language::XPathScript
+  AxAddStyleMap text/xsl Apache::AxKit::Language::LibXSLT
+
+Start apache via C<apachectl start>
+
+=head2 Test AxKit
+
+Somewhere in your web server documents tree, create test.xml containing:
+
+  <?xml version="1.0"?>
+  <?xml-stylesheet href="test.xsl" type="text/xsl"?>
+    <dromedaries>
+      <species name="Camel">
+        <humps>1 or 2</humps>
+        <disposition>Cranky</disposition>
+      </species>
+      <species name="Llama">
+        <humps>1 (sort of)</humps>
+        <disposition>Aloof</disposition>
+      </species>
+      <species name="Alpaca">
+        <humps>(see Llama)</humps>
+        <disposition>Friendly</disposition>
+      </species>
+  </dromedaries>
+
+In the same directory, create test.xsl containing:
+
+  <?xml version="1.0"?>
+  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+  version="1.0">
+  <xsl:template match="/">
+    <html>
+    <head><title>Know Your Dromedaries</title></head>
+    <body>
+      <table bgcolor="eeeeee" border="1">
+      <tr>
+      <th>Species</th>
+      <th>No of Humps</th>
+      <th>Disposition</th>
+      </tr>
+      <xsl:for-each select="dromedaries">
+        <xsl:apply-templates select="./species" />
+    </xsl:for-each>
+    </table>
+    </body>
+    </html>
+  </xsl:template>
+
+  <xsl:template match="species">
+    <tr>
+    <td><xsl:value-of select="@name" /></td>
+    <td><xsl:value-of select="./humps" /></td>
+    <td><xsl:value-of select="./disposition" /></td>
+    </tr>
+  </xsl:template>
+
+  </xsl:stylesheet>
+
+Then, start apache if you haven't already, and point your browser at
+http://your-server.com/path/to/test.xml
+
+But wait!  Even if the page looks right, don't celebrate just yet.  
+View the source of the document, and verify it is the expected HTML output, 
+and not just the XML document.  Some browsers will parse the xml-stylesheet 
+operation themselves, and create the same result as if AxKit had done the 
+work.
+
+If everything worked, NOW you can celebrate.