I'm trying to use the Macromedia XSLTransform class to convert XML returned from Amazon Web Services to HTML. Here's the PHP page that calls the transform:
<?php
require_once('includes/MM_XSLTransform/MM_XSLTransform.class.php');
$restquery = "http://ecs.amazonaws.com/onca/xml?Service=AWSECommerceService&AWSAccessKeyId=[myid]&Operation=ItemLookup&ResponseGroup=Large&ItemId=" . htmlspecialchars($_GET["asin"]);
$mm_xsl = new MM_XSLTransform();
$mm_xsl->setXML($restquery);
$mm_xsl->setXSL("aws1.xsl");
echo $mm_xsl->Transform();
?>
And here's a snippet of the aws1.xsl page
<?xml version="1.0"?>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:aws="http://webservices.amazon.com/AWSECommerceService/2006-06-07">
<xsl:output method="html" encoding="UTF-8" omit-xml-declaration="yes"/>
<xsl:template match="aws:Item">
<html>
<body>
<table>
<tr>
<td style="border-bottom:#C0C0C0 dotted 1px;padding:10px">
<table cellpadding="0" cellspacing="0" style="width: 90%;padding:5px">
<tr>
<xsl:if test="aws:SmallImage/aws:URL">
<td valign="top" width="50">
<img>
<xsl:attribute name="src">
<xsl:value-of select="aws:SmallImage/aws:URL" disable-output-escaping="yes" />
</xsl:attribute>
<xsl:attribute name="border">0</xsl:attribute>
</img>
</td>
</xsl:if>
<!-- bunch of other stuff -->
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
The basic code is working - I get data on the expected ASIN item back. And I know the XSL basically works because if I intentionally put an invalid attribute in I get a parser error. But what I get back is a big unformatted bunch of text instead of HTML. I've tried various <xsl:output method>
options, but none seems to work. I thinks it's some kind of encoding or charset problem.