[thelist] [PHP] xslt_process
Paul Bennett
Paul.Bennett at wcc.govt.nz
Tue Jul 3 22:54:51 CDT 2007
Hi all,
I'm having weirdness with xslt_process (on Solaris 9)
Basically, Sablotron will happily open local xml and xl files to perform a transformation, but gives this error when I try to pass file content as a variable:
--------
Sablotron error on line 1: unknown encoding ''
----------
I've googled, I've fiddled and darn near given up, so I thought I'd consult the guardians of all knowledge residing here :)
Paul
(If you need source code, it's here):
--------------------------------------------
<?php
/*
This works
*/
$xh = xslt_create();
// Process the document
if ($myResult = xslt_process($xh, 'search.xml', 'search-output.xsl')) {
echo $myResult;
} else {
echo "error: " . xslt_error($xh) . " code is " . xslt_errno($xh);
}
xslt_free($xh);
/*
this doesn't
*/
// yes, I've checked - this is the same xml as in search.xml as above
$xml = file_get_contents('http://search.wellington.govt.nz/search?q=poneke&hl=en&lr=&ie=UTF-8&output=xml_no_dtd&client=default_frontend&access=p&sort=date:D:L:d1&start=10&sa=N', 'r');
//$xml = file_get_contents('search.xml');
//echo $xml;
// write to file (savblotron is retarded when)
$xsl = file_get_contents('search-output.xsl');
$xh = xslt_create();
// Process the document
if ($myResult = xslt_process($xh, $xml, $xsl)) {
echo $myResult;
} else {
echo "error: " . xslt_error($xh) . " code is " . xslt_errno($xh);
}
xslt_free($xh);
?>
--------------------------------------
More information about the thelist
mailing list