OK, i finally found a solution/ the error.
This is for anyone who has the same problem. I don't know if its my php configuration but it seems that when suing the readfile() function with relative paths it looks in the php root folder and if you specify a path it fails to read the content correctly´, hence unknown encoding.
So I rewrote my script using the fopen() instead. For this to work I put the content into variables and applied them to an argument array as shown below and now it works.
Kind regards
Lennart Pedersen
<?php
// $xml and $xsl contain the XML and XSL data
$arguments = array(
'/xml' => $xml,
'/xsl' => $xsl
);
// Allocate a new XSLT processor
$xh = xslt_create();
// Process the document
$result = xslt_process($xh, 'arg:/xml', 'arg:/xsl', NULL, $arguments);
if ($result) {
print "SUCCESS, sample.xml was transformed by sample.xsl into the \$result";
print " variable, the \$result variable has the following contents\n<br>\n";
print "<pre>\n";
print $result;
print "</pre>\n";
}
else {
print "Sorry, sample.xml could not be transformed by sample.xsl into";
print " the \$result variable the reason is that " . xslt_error($xh) .
print " and the error code is " . xslt_errno($xh);
}
xslt_free($xh);
?>