[nona.net home]
not logged inlog in
> home> software> php_libxslt

this icon looks like a:
place name

php_libxslt - a simple libxslt PHP/XSL extension

Overview ::
php_libxslt is a very simple PHP extension to transform XML documents using the GNOME XSLT C library.(link, external) It provides an alternative XSLT engine to the current PHP default XSL extension. It currently seems to work fine (and serves this site since more than 2 years), but there's (as always) room for improvements. There's e.g. no serious error handling implemented yet (any volunteers?).
php_libxslt has been tested using PHP4.1.2/libxslt 1.0.16 on Linux/PowerPC (Debian/woody), PHP4.2.3/libxslt 1.0.16 on Linux/i386 (Debian) and PHP4.3.1 on Linux/i386 (RedHat), test reports (success/failure) especially regarding platforms different from Linux are welcome, contact axelm-php(at)nona.net.
Download ::
Note: The file below is rather small (about 15kB), so the download may be finished within just a few seconds. Note well: Retrying doesn't increase the file's size ;).
md5sum: 08e896ccc06c5c79d47e90de646e07c0
Installation ::
Please refer to the file INSTALL in the tarball if you are installing from source, or to the dpkg man page if you are using the Debian packages. For building the Debian packages from the source tarball please refer to INSTALL.Debian.
Usage ::
php_libxslt has a very simple interface (as it provides just one function). A few examples are provided in the "examples" directory of the distribution. Simply transforming XML using an XSL stylesheet is done by calling:
   $transformed = libxslt_transform($xmlstring, $xsltstring); 
first argument: XML string to be transformed (no file name, the XML document itself)
second argument: XSL stylesheet string (again, no file name, stylesheet itself required)
return value: Transformation output (if transformation did succeed) or XML input document (if transformation did fail).
Adding XSLT parameters ::
If you want to hand over parameters to your stylesheet, call the function with the (optional) third argument containing the XSL parameters in a hash:
   $xslparam['ExampleParameter'] = "'Example Value'";
   $xslparam['OtherParameter'] = "'Another Value'";
   $transformed = libxslt_transform($xmlstring, 
                       $xsltstring, $xslparam); 
(Be careful regarging quoting of the parameter strings, unquoted parameters will be interpreted by libxslt)
Error handling ::
If, for any reason, the XSL transformation does not succeed, the original XML string is returned. Detailed error messages should show up in your web servers error log.
Questions? Feedback? ::
Feel free to contact me at axelm-php(at)nona.net. Feedback, comments, questions and build/bug reports are welcome.

php_libxslt - changes
v0.3.0 ::
20050205 - added XSLT parameter support
v0.2.2 ::
20041201 - fixed a memory leak
v0.2.1 ::
20031304 - added Debian packaging files
v0.2 ::
20030415 - fixed build environment and some typos. Compiles now with PHP 4.3
v0.1 ::
20030304 - initial release