Documentation
Compilation
mod_transform
uses the "configure/make/make install
"
mechanism common to many Open Source programs.
Most of the dirty work is handled by either configure or
Apache's apxs utility. If you have built Apache modules before, there
shouldn't be any surprises for you.
The interesting options you can pass to configure are:
--with-apxs=/path/to/apache/dir/bin/apxs
This option is used to specify the location of the apxs utility that was installed as part of apache. Specify the location of the binary, not the directory it is located in.
--with-xslt-prefix=PREFIX
Prefix where
libxslt
is installed.--with-xslt-exec-prefix=PREFIX
Exec prefix where
libxslt
is installed.--with-xml-prefix=PREFIX
Prefix where
libxml2
is installed.--with-xml-exec-prefix=PREFIX
Exec prefix where
libxml2
is installed.--help
Provides a list of available configure options.
./configure --with-apxs=/usr/sbin/apxs2 make make install
Integration into Apache
To activate mod_transform
Just add
LoadModule transform_module modules/mod_transform.so
to your httpd.conf
and restart Apache.
mod_transform
also provides two exported functions for other modules to use the XSLT processor:
void mod_transform_set_XSLT(request_rec* r, const char* name) ; void mod_transform_XSLTDoc(request_rec* r, xmlDocPtr doc) ;
Configuring with Apache
Besides registering an output filter with the name XSLT
,
mod_transform
has the following additional directives:
For details on assigning output filters in Apache 2,
please see the Filters Documentation. To get basic XSLT
parsing for your xml files,
just add the following to your httpd.conf
:
AddOutputFilter XSLT xml
TransformAnnounce
Description: | Whether to announce this module in the server header. |
---|---|
Syntax: | TransformAnnounce [On|Off] |
Default: | On |
Context: | server config, virtual host. |
Enables or Disables showing mod_transform
in the Apache Server Name string.
TransformCache
Description: | Cache an XSLT Stylesheet on Server Startup. |
---|---|
Syntax: | TransformCache URL FILE_PATH |
Default: | none |
Context: | server config, virtual host. |
This directive forces a specific XSLT Stylesheet to be preloaded by the server on startup. This can signifigantly increase performance.
TransformCache /project/myfile.xsl /usr/local/share/project/myfile.xsl
TransformOptions
Description: | Configure optional features |
---|---|
Syntax: | TransformOptoins [+|-]option [[+|-]option] ... |
Default: | XIncludes |
Context: | server config, virtual host, directory, .htaccess. |
This directive can enable or disable specific mod_transform
features on a per-location
basis.
- ApacheFS
-
Enables an overlay of the Apache Document Root as the Root Filesystem for all
libXML2
Input/Output operations. For an example with+ApacheFS
in effect, consider the following XInclude:<xi:include href="/xi/special.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
Normally, this would request the file/xi/special.xml
directly from the filesystem. With+ApacheFS
it will do aSubrequest
for this file. This means if yourDocumentRoot
is/src/vhost1/html
,libXML2
will read/src/vhost1/html/xi/special.xml
. This provides compatibility with Apache Axkit. - None
-
Turns off all previous
TransformOptions
. - XIncludes
-
Enables or disables
XML Inclusions (XInclude) Version 1.0
support in
libXML2
.
<Directory "/path/to/my/docroot"> TransformOptions +ApacheFS +XIncludes </Directory>
TransformSet
Description: | Force a specific XSLT File to be used. |
---|---|
Syntax: | TransformSet FILE_PATH |
Default: | none |
Context: | server config, virtual host, directory, .htaccess. |
This directive forces a specific XSLT Stylesheet for any files it is applied against.
<LocationMatch /*/index.xml> TransformSet /project/myfile.xsl </LocationMatch>