note 51447 deleted from function.xslt-process by sobak
| From: | sobak@php.net | Date: | Tue, 22 Nov 2016 03:36:24 +0000 |
| Subject: | note 51447 deleted from function.xslt-process by sobak | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-207379@lists.php.net to get a copy of this message | ||
Note Submitter: csarven at gmail dot com
----
I found using the output buffer to be efficient, when dealing with php scripts, with xml data.
<?
$xh = xslt_create();
ob_start();
include('main.php'); //main.php contains php and xml
$xml_file = ob_get_contents();
ob_end_clean();
$arguments = array('/_xml' => $xml_file);
$result = xslt_process($xh, 'arg:/_xml', 'index.xsl', NULL, $arguments);
if (!$result) echo 'XSLT processing error: ' .xslt_error($xh) ;
else echo $result;
xslt_free($xh);
?>