Jump to content

Using XSL Sheets


richardstan

Recommended Posts

Hi, ive created an XSL Style sheet which will be associated with an XML document using the following code:

$path_xml = "freedomland.xml";
$path_style = "forest.xsl";

$xml_obj = new DomDocument;
$xsl_obj = new DomDocument;

if(!$xml_obj->load($path_xml)){
	echo "Error! Unable to open " . $path_xml. "!\n";
	exit;
}
if(!$xsl_obj->load($path_style)){
	echo "Error! Unable to open ". $path_style . "!\n";
	exit;
}

$xslt_parse = new xsltprocessor;

$xslt_parse->importStyleSheet($xsl_obj);

echo $xslt_parse->transformToXML($xml_obj);

 

however, when i try to run this PHP file, i get an error saying that the program was unable to open forest.xsl ( the name of my xsl file). The file definately exists and the code is written correctly. Windows also throws a similar error when i'm trying to load the file from Windows Explorer, "Window Cannot find 'forest.xsl'. Make sure you typed the name correctly, and then try again." but the file content will still load into Dreamweaver. Are the errorrs in my script and the Windows Explorer error in any way related?

Thanks

Richard.

Link to comment
https://forums.phpfreaks.com/topic/136106-using-xsl-sheets/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.