note 9843 added to xslt_transform
| From: | dietricha at subpop dot com | Date: | Mon, 27 Nov 2000 21:37:30 +0000 |
| Subject: | note 9843 added to xslt_transform | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-8171@lists.php.net to get a copy of this message | ||
the syntax for the first example is wrong, and the second sample is a bit misleading.
The $xsl and $xml arguments for xslt_transform() are *URI's*, not strings of xml data.
using strings of xml data will stop script execution and give this error:
Error [code:237]
unsupported URI scheme '<?xml version="1.0"?>
<xsl'....
here is the sample code from my enhanced version of the XSLTransformer wrapper class (originally by
Justin Grant, from an article on phpbuilder.com). my version added support for this function, and is
available here:
http://www.subpop.com/~dietricha/php_sablot.php
<?
include "../classes/class.XSLTransformer.php";
$params = array("display" => "category");
$xslt = new XSLTransformer();
$xslt->setVars('api.xsl','api_domxml.xml',$params);
if($xslt->xslt_transform()){
echo $xslt->getOutput();
} else {
echo $xslt->getError();
}
?>
http://www.php.net/manual/function.xslt-transform.php