I’m trying to program a homepage with some XML transformations with XSLT. I’m using lampp on a Fedora system. I start with this php code:
<?php
$xh = xslt_create();
if (xslt_process($xh, 'sample.xml', 'transform.xsl', 'result.xml')) {
readfile('result.xml');
}
else {
print "Could not be transformed by transform.xsl into";
print " result.xml the reason is that " . xslt_error($xh) . " and the ";
print "error code is " . xslt_errno($xh);
}
xslt_free($xh);
?>
The Error message i get is the following:
Fatal error: Call to undefined function xslt_create() in /opt/lampp/htdocs/test/test.php on line 2
I thought it would work if I install libxml2, libxml-devel, libxslt, and libxslt-devel, but in the end there was the same error message. I also tried php-xml, but without success. Maybe it is because of lampp? Any other ideas or solutions for my problem?
Thanks in advance!
XSL functionality is available in the
php-dompackage for PHP 5.The function
xslt_createDocs is from the XSLT (PHP 4) extensionDocs. It is outdated.Instead there is the XSL extensionDocs which works with PHP 5 (the current PHP version, PHP 4 is dead).
IIRC there is some fallback-library written in PHP code itself, that is able to mimic the syntax of the PHP 4 extension with the current DOM extension. But I can not tell you where nor how good that was because it is long ago and I do not remember well. also it is easier to use the new extension.