note 104572 modified in book.xsl by danbrown
| From: | danbrown@php.net | Date: | Thu, 23 Jun 2011 14:22:53 +0000 |
| Subject: | note 104572 modified in book.xsl by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-180875@lists.php.net to get a copy of this message | ||
This is more usefull, no files needed, it just takes XML and XSL strings as input parameters and
returns transformed XML
<?php
/**
* @param $xml
* @param $xsl
* @return string xml
*/
function transform($xml, $xsl) {
$xslt = new XSLTProcessor();
$xslt->importStylesheet(new SimpleXMLElement($xsl));
return $xslt->transformToXml(new SimpleXMLElement($xml));
}
?>
--was--
<?php
/**
* This is more usefull, no files needed, it just
* takes XML and XSL strings as input parameters
* and returns transformed XML
*
* @param $xml
* @param $xsl
* @return string xml
*/
function transform($xml, $xsl) {
$xslt = new XSLTProcessor();
$xslt->importStylesheet(new SimpleXMLElement($xsl));
return $xslt->transformToXml(new SimpleXMLElement($xml));
}
?>
http://php.net/manual/en/book.xsl.php