mod_xobjex for Apache httpd 1.3.x

mod_xobjex converts HTTP requests for files ending with ".xsl" into an XML graph [try it] to which the requested ".xsl" file is applied.

One of the first examples seen when learning XSL is that of an XML document that refers to an XSL template in a processing instruction. We've turned that process around. Ask for the template first, apply it to a parameters document (the converted HTTP Request), and use the document() function, as necessary, to complete the computation or transformation.

The reader may like to visit Stack & The Succulent Stem which is a blog written by the author of mod_xobjex. The Blog covers web application development with XSLT and RSS. Use Firefox's Live Bookmarks to keep up to date.

requires

  1. Apache httpd 1.3.x
  2. Daniel Veillard's libxml2 and libxslt.

hello world

Call the following URL and you get "Hello World":
http://xobjex.com/projects/mod_xobjex/hello.xsl

Call the same URL but append the query string "?name=Bob", and you'll get "Hello Bob":
http://xobjex.com/projects/mod_xobjex/hello.xsl?name=Bob

Here is the source for the previous example:
http://xobjex.com/projects/mod_xobjex/hello.xsl.txt

The previous example demostrates the HTTP GET method. The same applies to HTTP POST (named form elements), and HTTP Cookies.

command parameters & reserved parameter names

mod_xobjex uses three parameter names to perform persistance (write data to the file system) and HTTP Redirects. They are instance, view, and print. There is an example html form here. Just add '?print=env' to see the XML graph the requested XSL file is being applied to [like this].

To say that these potential parameter names are "reserved" is a bit inaccurate. Actually, the first occurance of these names is reserved. A programmer can still use the names in every position except [1]. For example, mod_xobjex will use the value of //@instance[1] (tip: //@instance is, in this case, shorthand for '/parameters/parameter/@instance[1]') but the programmer may use the value of //@instance[2], [3], [n...].

installation

  1. Verify that you have a late version of libxml2 and libxslt.
  2. Verify that 'apxs' is on your path (it should have installed with your Apache installation).
  3. Download mod_xobjex.tar.gz.
  4. Un-tar the file (i.e. tar -zxf mod_xobjex.tar.gz )
  5. enter the mod_xobjex directory (i.e. cd path/to/mod_xobjex)
  6. If your 'lib' and 'include' directories are NOT in '/usr/local', type 'make WITH_PREFIX=/PATH/TO/PREFIX all' otherwise type 'make all'
  7. Switch user (su) to a user with permission to write into '/path/to/apache/installation' (i.e. root)
  8. Type 'make install'
  9. Verify that the following items are in your 'httpd.conf' file:
    1. LoadModule xobjex_module libexec/apache/mod_xobjex.so
    2. AddModule mod_xobjex.c
    3. <IfModule mod_xobjex.c>
      <FilesMatch "\.xsl$">
      SetHandler xobjex-handler
      </FilesMatch>
      </IfModule>
  10. Restart your Apache httpd. You may also 'make reload'.

If you have trouble check our blog or email support@xobjex.com.