load($doc); $xsl = new DOMDocument; $xsl->load($xss); // Configure the transformer $proc = new XSLTProcessor; $proc->importStyleSheet($xsl); // attach the xsl rules //if ($_SERVER['argc'] >= 4) //{ if (is_dir($_SERVER['argv'][3])) { if (!$proc->setParameter('', 'base.dir', $_SERVER['argv'][3])) echo "setting param base.dir KO\n"; } else { //echo "{$_SERVER['argv'][3]} is not a dir\n"; } //} $out = $proc->transformToXML($xml); if (!is_dir($_SERVER['argv'][3])) file_put_contents($_SERVER['argv'][3], $out); echo "OK\n"; ?>