Ok. I have 3 files sitting on the server; a PHP file, an XML file, and an XSL file. Ideally what I would like to do is include the XML file in the PHP file such that all the contents of the XML file still get processed by the XSL code. If I type the path of the XML file into the browser it opens the XML file and outputs the data according to the XSL code attached inside of it (the XSL is just a style cheet for displaying XML). So far so good.
Now I would like to include this XML file within the PHP file and have it display the same way that it did when it was opened directly. Thus far I have tried two methods for doing this.
1) <?php include('menuData.xml'); ?>
The following error is reported:
Parse error: parse error, unexpected T_STRING in /home/temp/menuData.xml on line 1
This makes sense since the include function is not meant for XML files.
2) <?php echo file_get_contents('menuData.xml'); ?>
The following is produced:
" button_one.gif 1 - 1 1 - 2 1 - 3 button_two.gif 2 - 1 2 - 2 2 - 3 button_three.gif 3 - 1 3 - 2 3 - 3 "
This is just all the contents of the XML file.
What I would like produced is the same thing that was outputed when the XML file was opened directly by the browser. Any help on the matter is appreciated. The files are shown below.
menuData.xml
menuStyle.xsl
menu.php