Helpful Information
 
 
Category: Programming Languages More
XML and XSLT + PHP question...

Can anyone shed some insight to how I can fix this problem...

I have 6 files...
events.xml - an ordinary XML document.
events.xsl - an ordinary XSL stylesheet
header.php - a PHP file that contains the first half of the website design
footer.php - a PHP file that contains the last half of the website design.
upcoming.phtml - the PHP file that the end user will see.

My question is this, is there an alternative to Sablotron, the built in toolkit in PHP4? My web host doesnt have PHP compiled with the --with-sablot argument. I have requested this, but I havent heard anything back yet, and I am searching for an alternative.

I need to parse the XML document, apply the XSL stylesheet, then insert it into the phtml file like so...



require("header.php");
// XML data with XSL stylesheet applied to it.
require("footer.php");


Any suggestions? I originally tried a require("events.xml"); with the XSL stylesheet applied within the XML document, but I forgot that inside the PHTML file, the server won't just normally parse the XML document.

I bet there is an easy answer, and I am just missing it, but any help is appreciated.

How about doing something like

require("header.php");
readfile("events.xml");
require("footer.php");


readfile() will read the events.xml file and output it to the browser. If you have the
<?xml:stylesheet type="text/xsl" href="events.xsl"?>
line in events.xml it should also parse that and apply the xsl stylesheet.

If that doesn't work, check out www.phpwebhosting.com . They support sablotron (and just about every other extension). You can see a phpinfo() page at
http://blinkin.phpwebhosting.com/phphoststest.phtml

Thank you for your feedback, but right after I posted that I read about the SAX parser in the DevShed XML page. That seemed to do the trick for me very nicely.










privacy (GDPR)