Exemple #1
0
        $xml->save("xml/site.xml");
        echo $update_value;
        return;
    }
}
// Create instances of the DomDocument class
$xml = new DomDocument();
$xsl = new DomDocument();
$xsltproc = new XsltProcessor();
// Load the xml document and the xsl template
$xml->validateOnParse = true;
$xml->preserveWhiteSpace = true;
$xsl->preserveWhiteSpace = true;
$xml->load("xml/site.xml");
if ($isAdmin == true) {
    $xsl->load("xml/admin.xsl");
} else {
    $xsl->load("xml/online.xsl");
}
// Load the xsl template
$xsltproc->importStyleSheet($xsl);
//Transform to XML in a tempfile and include the result.
//With this method, PHP code embeded in XML is executed.
$tmpfname = tempnam("tmp", $page . "-");
$xsltproc->setParameter('', 'page', $page);
$processed = $xsltproc->transformToURI($xml, $tmpfname);
include $tmpfname;
unlink($tmpfname);
unset($xsltproc);
unset($xsl);
unset($xml);