Forum Moderators: coopster
I have just stumbled across this code (below) and really like coding xsl so figure I will use this rather then simpleXML to parse my XML to html using php5
Is this OK to use for a Live site?
What are the pros and cons?
I figure I will have this inside my php scripts where I want this content to appear (inside other php/html code, Not to produce a whole page, I think(not sure if that good practice?) just in planning stage now (it's for a bespoke cms I'm building)
Just seems to work fine etc, just want to make sure it's not a too good to be true thing becasue it makes my life easy
Also can you add php functions within the .xsl file or is that just pushing my luck!
$xml = new DOMDocument;
$xml->load("somexml.xml");
$xsl = new DOMDocument;
$xsl->load("somexsl.xsl");
// Configure the transformer
$proc = new XSLTProcessor;
$proc->importStyleSheet($xsl); // attach the xsl rules
echo $proc->transformToXML($xml);