website stat

PHP4 to PHP5 XSLT wrapper

If you used the XSLT extension on one of your PHP4 applications (probably using the Sablot library) and you've moved to PHP5 then you may know by now that XSLT library is now gone in favor of libxml and XSL to perform XSL Transformations (you'll notice this when a fatal error shows up complaining about xsl_create()). You have three options

  1. Forget about PHP5 and carry on with PHP4 (not a good option IMHO)
  2. Change all your code to use XSL from PHP5
  3. Use a wrapper or the way the Gang of Four would actually call it, an Adapter Design Pattern;

If you're into the third option, congratulations, for most of the cases it's the best thing to do. And I can give you a help on that. Just go here and download the small PHP file and then put the following code on the top of your PHP file that does XSL transformations.

PHP:
  1. if (version_compare(PHP_VERSION,'5','>=')&&extension_loaded('xsl'))<br />
  2. require_once('xslt-php4-to-php5.php');


No Responses to “PHP4 to PHP5 XSLT wrapper”

Comments are closed.