←back to thread

392 points _kush | 1 comments | | HN request time: 0.322s | source
1. ulrischa ◴[] No.44396898[source]
Throw in php in the mix and you have a wonderful solution for templating with bullet proof standards:

// XML $xml_doc = new DOMDocument(); $xml_doc->load("file1.xml");

// XSL $xsl_doc = new DOMDocument(); $xsl_doc->load("file.xsl");

// Proc $proc = new XSLTProcessor(); $proc->importStylesheet($xsl_doc); $newdom = $proc->transformToDoc($xml_doc);

print $newdom->saveXML();

XSLT lacks functionality? No problem, use php functions in xslt: https://www.php.net/manual/en/xsltprocessor.registerphpfunct...

RTFM