note 55513 deleted from book.xsl by sobak
| From: | sobak@php.net | Date: | Thu, 24 Nov 2016 17:35:42 +0000 |
| Subject: | note 55513 deleted from book.xsl by sobak | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-207556@lists.php.net to get a copy of this message | ||
Note Submitter: olivier dot sow at alias dot france
----
if you have 'XML parser error 4: not well-formed (invalid token)' error without but your
are sure to do no error at all, try this:
<?
function
XSL_transformation($XMLFile,$XSLFile,$ResultFile,$xsl_params){
$Str = '';
$xp = xslt_create() or trigger_error('Could not create XSLT process.', E_USER_ERROR);
xslt_set_encoding($xp, 'ISO-8859-1');
// read the files into memory
$xsl_string = join('', file($XSLFile));
$xml_string = join('', file($XMLFile));
// set the argument buffer
$arg_buffer = array('/xml' => $xml_string, '/xsl' => $xsl_string);
// process the two files to get the desired output
if (($Str = xslt_process($xp, 'arg:/xml', 'arg:/xsl', NULL, $arg_buffer,
$xsl_params))){
//Saves transformation result into '$ResultFile'
$fp = fopen($ResultFile,"w+");
fwrite($fp,$Str);
fclose($fp);
return true;
}
return false;
}
?>
found here: http://bugs.php.net/bug.php?id=16193