xsl transform template for php5

// path to the xml document (may be url)
$xml = "data.xml";
// path to the xsl document (may be url)
$xsl = "transformation.xsl";  

$xslDoc = new DOMDocument();
$xslDoc->load($xsl);

$xmlDoc = new DOMDocument();
$xmlDoc->load($xml);

$proc = new XSLTProcessor();
$proc->importStylesheet($xslDoc);
echo $proc->transformToXML($xmlDoc);

Leave a comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.