working with xml from a php file for xsl transformations
| From: | jonathan | Date: | Fri, 30 Sep 2005 05:41:51 +0000 |
| Subject: | working with xml from a php file for xsl transformations | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-223445@lists.php.net to get a copy of this message | ||
I have a couple of files where I output xml based upon URI parameters passed into a PHP file.
So I end up getting urls like this:
menu_render.php?menu_id=4&format=xml
which outputs xml just fine to a web browser but doesn't seem to work for a server.
The problem I'm having is that I'd like to be able to open this file and then transform it via a stylesheet like below. Unfortunately, it gives me the following error:
Warning: I/O warning : failed to load external entity "menu_render.php?menu_id=4&format=xml" in...
I thought I was able to so this before. Does anybody know what I'm doing wrong. Help! Do you think it's a permissions issue?
Code:
//works ok
$xsl=new DomDocument();
$xsl->load('xsl_arc.xsl');
//works ok
$xslt=new XSLTProcessor();
$xslt->importStyleSheet($xsl);
$xml=new DomDocument();
//neither of these work
//$menu=file_get_contents(urlencode('menu_render.php?menu_id=4&format=xml'));
$xml->load('menu_render.php?menu_id=4&format=xml');
//this will load ok if just a scrape of the above
//$xml->load('menu.xml');
$results=$xslt->transformToXml($xml);
echo $results;