Hi,
I have a simple xml file. The xml file has an xsl style-sheet reference to "cdcatalog.xsl". When I open the xml file in my browser, the transformation is applied properly and a formated page is shown. But when I try to generate the xml file's contents through php, no transformation is applied. Do I need to do any settings in Apache?
style sheet called "cdcatalog.xsl"--->
<?xml version="1.0" encoding="ISO-8859-1"?><xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:template match="/">
<html>
<body>
<h2>My CD Collection</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th align="left">Title</th>
<th align="left">Artist</th>
</tr>
<xsl:for-each select="catalog/cd">
<tr>
<td><xsl:value-of select="title"/></td>
<td><xsl:value-of select="artist"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template></xsl:stylesheet>
xml file "test.xml"-->
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="cdcatalog.xsl"?>
<catalog>
<cd>
<title>Empire Burlesque</title>
<artist>Bob Dylan</artist>
<country>USA</country>
<company>Columbia</company>
<price>10.90</price>
<year>1985</year>
</cd>
</catalog>
Working fine. Now generate the above xml file through the simple php script below, no transformation done.
PHP Script "test.php"
<?php
echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n".
"<?xml-stylesheet type=\"text/xsl\" href=\"cdcatalog.xsl\"?>".
"<catalog>".
"<cd>".
"<title>Empire Burlesque</title>".
"<artist>Bob Dylan</artist>".
"<country>USA</country>".
"<company>Columbia</company>".
"<price>10.90</price>".
"<year>1985</year>".
"</cd>".
"</catalog>";
?>
Note: All three files are in the same folder and Apache 2.0.54 setup and accessed through localhost. Browser used: InternetExplorer 6.0 on winXP