note 86382 deleted from xsl.examples by cmb
| From: | cmb@php.net | Date: | Mon, 08 Mar 2021 12:35:47 +0000 |
| Subject: | note 86382 deleted from xsl.examples by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-219173@lists.php.net to get a copy of this message | ||
Note Submitter: contato at log dot blog dot br
----
Here's a very simple example on how to use PHP5 to transform a XML file using a XSL file.
<?php
$xslDoc = new DOMDocument();
$xslDoc->load("collection.xsl");
$xmlDoc = new DOMDocument();
$xmlDoc->load("collection.xml");
$proc = new XSLTProcessor();
$proc->importStylesheet($xslDoc);
echo $proc->transformToXML($xmlDoc);
?>
For the sake of simplicity there's no error handling on this code. I hope this helps.