Hello Every One,
I am trying to transform XML And XSL file using PHP.
My Code for Transforming XML and XSL is as follows:
<?
global $xmlFile;
global $xslFile;
$xmlFile= "default.xml";
$xslFile="default.xsl";
//Parses a XML and XSL File and returns the Result File.
function processXsl($xmlFile, $xslFile)
{
// Allocate a new XSLT processor
$xh = xslt_create();
//Process the document
if (!$result=xslt_process($xh, $xmlFile, $xslFile)) {
print "Sorry, sample.xml could not be transformed by sample.xsl into";
print " result.xml the reason is that " . xslt_error($xh) . " and the ";
print "error code is " . xslt_errno($xh);
}
xslt_free($xh);
return $result;
}
//Convert the XML File into Resultant XSL and Fetch Result in to a variable
$result= processXsl($xmlFile, $xslFile);
echo $result;
?>
Problem is that whenever XSL contains " " in it, then for printing spaces PHP converts it into Â. Can any one tell me what i am doing wrong?
Thanks for your help.