The example above is a bit confusing because it uses the same variable ($doc) for two different things. I would rather write
<?php
$xsl = new XSLTProcessor();
$xsldoc = new DOMDocument();
$xsldoc->load($xsl_filename);
$xsl->importStyleSheet($xsldoc);
$xmldoc = new DOMDocument();
$xmldoc->load($xml_filename);
echo $xsl->transformToXML($xmldoc);
?>
[ Editor's note - thiago AT php DOT net: This note has improvements from Matthieu ]
XSLTProcessor::__construct
(PHP 5)
XSLTProcessor::__construct — Creates a new XSLTProcessor object
Parametry
Ta funkcja nie posiada parametrów.
Zwracane wartości
nie jest zwracana żadna wartość.
Przykłady
Przykład #1 Creating an XSLTProcessor
<?php
$doc = new DOMDocument();
$xsl = new XSLTProcessor();
$doc->load($xsl_filename);
$xsl->importStyleSheet($doc);
$doc->load($xml_filename);
echo $xsl->transformToXML($doc);
?>
XSLTProcessor::__construct
Martin
04-Jun-2009 10:02
04-Jun-2009 10:02
