Created
October 24, 2018 09:09
-
-
Save lbrutti/7c366198cb2556bfe723fa961cf47fd0 to your computer and use it in GitHub Desktop.
a simple php script to apply an XSLT to an XML file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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