Processing XSLT with PHP.
by Mike
I’ve been playing around with XSLT recently, with the hope of using it to move to a more “MVC” approach to web development.
If like me, you don’t use Apache, and want a little more control over your XSLT processing, PHP has a fantastic XSLT class that can do just that!
<?php
$dom = new DomDocument();
$dom->load( ‘test.xml’ );
$xslt = new XSLTProcessor();
$XSL = new DOMDocument();
$XSL->load( ‘xslt/layout.xsl’, LIBXML_NOCDATA);
$xslt->importStylesheet( $XSL );
print $xslt->transformToXML( $dom );
?>
It’s as easy as that.
Mike Hughes.