Littlened
12 Jul 2006, 06:33 PM
ok, I've got a script that gets data from an sql database and formats it as XML, I've created an XSL sheet to format the xml data. Now, I want to be able to include PHP code within the XSL sheet.
I'm using the following code to merge the xml code (held in a string) with the xsl file held on the server.
// get completed xml document
$xml_string = $doc->dump_mem(true);
// $xml and $xsl contain the XML and XSL data
$arguments = array('/_xml' => $xml_string);
// Allocate a new XSLT processor
$xh = xslt_create();
// Process the document
$result = xslt_process($xh, 'arg:/_xml', $xsl_file, NULL, $arguments);
echo $result;
xslt_free($xh);
I've tried the eval function, but no matter what I do the final result just seems to remove any PHP code from the XSL style sheet, but doesnt seem to parse the PHP code as there is no output.
Anyone any ideas?
I'm using the following code to merge the xml code (held in a string) with the xsl file held on the server.
// get completed xml document
$xml_string = $doc->dump_mem(true);
// $xml and $xsl contain the XML and XSL data
$arguments = array('/_xml' => $xml_string);
// Allocate a new XSLT processor
$xh = xslt_create();
// Process the document
$result = xslt_process($xh, 'arg:/_xml', $xsl_file, NULL, $arguments);
echo $result;
xslt_free($xh);
I've tried the eval function, but no matter what I do the final result just seems to remove any PHP code from the XSL style sheet, but doesnt seem to parse the PHP code as there is no output.
Anyone any ideas?