note 91296 modified in xsltprocessor.construct by thiago

From: Date: Tue, 20 Oct 2009 12:59:56 +0000
Subject: note 91296 modified in xsltprocessor.construct by thiago
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-161902@lists.php.net to get a copy of this message
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 ] --was-- 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($doc); $xmldoc->load($xml_filename); echo $xsl->transformToXML($xmldoc); ?> http://php.net/manual/en/xsltprocessor.construct.php

« previous php.notes (#161902) next »