Right now I transform an XML document with an XSLT stylesheet using Javascript (in a Wordpress-based website). This works fine in Firefox and Chrome, but not in IE. Plus, if Javascript is not enabled, nothing would show up.
So, my goal is to do the XML/XSLT transformation to XHTML on the server, not the client, preferably using PHP.
I've tried many different PHP scripts that other people have written (I'm a newbie) but I can't get them to work. I've included the simplest PHP script I've found below. I know the dynamic filepath might be a problem, but I don't know a better way to locate the XML and XSLT files.
When I use the below script, I get the error: Parse error: syntax error, unexpected T_STRING in /home/alan/public_html/wp-content/themes/Stacked/page-renting.php on line 42
Alternative solutions would be welcome as well.
<?php
$xml = new DOMDocument();
$xml->load('<?php bloginfo('template_directory'); ?>/rentals/works.xml');
$xsl = new DOMDocument;
$xsl->load('<?php bloginfo('template_directory'); ?>/rentals/works.xsl');
$proc = new XSLTProcessor();
$proc->importStyleSheet($xsl);
echo $proc->transformToXML($xml);
?>