Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
a simple php script to apply an XSLT to an XML file
<?php
if (count($argv) == 0) {
exit;
}
$xsltPath = $argv[1];
$xmlPath = $argv[2];
// $outputPath = $argv[3];
$xslt = file_get_contents($xsltPath);
$xml = file_get_contents($xmlPath);
$templateCMSObj = new \DOMDocument();
$templateCMSObj->loadXML($xslt);
$ekbXMLObj = new \DOMDocument();
$ekbXMLObj->loadXML($xml);
$proc = new \XSLTProcessor();
$proc->importStylesheet($templateCMSObj);
$html = $proc->transformToXML($ekbXMLObj);
echo($html);
exit;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.