That wasn't the article I meant to post, and I don't know where I read the one I did... hmmm.. Well I'll give you an example. This is an example translating the XBEL (an XML based bookmark format) file salmo.xbel using the XSLT stylesheet xbel-1.0-2.xsl.
PHP Code:
$xbel_path = "/path/to/salmo.xbel";
$xslt_path = "/path/to/xbel-1.0-2.xsl";
// Create an XSLT processor
$xsltproc = xslt_create();
// Perform the transformation
$html = xslt_process($xsltproc, $xbel_path, $xslt_path);
// Detect errors
if (!$html) die('XSLT processing error: '.xslt_error($xsltproc));
// Destroy the XSLT processor
xslt_free($xsltproc);
// Output the resulting HTML
echo $html;
I'm using the Sablotron XSLT functions for PHP by the way. You can see if you've got that installed by using this:
PHP Code:
if (function_exists("xslt_create")){
echo "Hells yeah!";
} else {
echo "Son of a...!";
}
Or you can look through the output of phpinfo(). If you need help installing Sablotron on Linux let me know.
Enjoy!
Bookmarks