Re: simpleXML expressions
| From: | Jason Barnett | Date: | Mon, 05 Jul 2004 07:00:36 +0000 |
| Subject: | Re: simpleXML expressions | ||
| References: | 1 | Groups: | php.xml.dev |
| Request: | Send a blank email to php-xml-dev+get-407@lists.php.net to get a copy of this message | ||
Another note about simpleXML. In most of the examples that talk about using the XsltProcessor they say to use DomDocuments for the xml / xsl files. However, I've noticed that you can also load the xml / xsl files into simpleXML objects. I haven't tested this much, but everything has worked as I would expect so far (PHP5-RC3). Are there any internal quirks which might make this A Bad Thing?
<?php
$xml = simpleXML_load_file('file.xml');
$xsl = simpleXML_load_file('file.xsl');
$proc = new XsltProcessor();
$proc->importStylesheet($xsl);
$doc = $proc->transformToDoc($xml);
?>