help using xslt_* functions
Posted: Fri Jul 02, 2004 5:44 pm
I'm going to keep this short and simple, if you need elaboration, please say so.
I've got an xml file I want to be parsed using an xslt stylesheet. I was using the xslt_* functions (http://us3.php.net/manual/en/ref.xslt.php) but the problem is when I do this in the middle of a PHP script like follows:
I get an xml prolog where $result is outputted. This I assume is invalid / unstructured markup. If i'm correct in assuming is there a way to stop the prolog from being displayed, or do I need to change the way I'm styling the xml file? Maybe there's even a way I didn't mention:) ?
Thanks a bunch for all the help / advice provided.
I've got an xml file I want to be parsed using an xslt stylesheet. I was using the xslt_* functions (http://us3.php.net/manual/en/ref.xslt.php) but the problem is when I do this in the middle of a PHP script like follows:
Code: Select all
<?php
// Write header information (i.e. <html>, <head>, etc.)
$xml_file = 'xml/links.xml';
$xsl_file = 'xml/links.xsl';
$xslt = xslt_create();
$fileBase = 'file://' . getcwd() . '/';
xslt_set_base($xslt,$fileBase);
$result = @xslt_process($xslt, $xml_file, $xsl_file);
if (!$result) echo 'XSLT processing error: ' .xslt_error($xslt);
else echo $result;
xslt_free($xslt);
// Write footer information (i.e. </html>, </body>, etc.)
?>Thanks a bunch for all the help / advice provided.