Re: Sending XML to MSIE7
| From: | Peter Ford | Date: | Fri, 15 Feb 2008 15:59:11 +0000 |
| Subject: | Re: Sending XML to MSIE7 | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-269371@lists.php.net to get a copy of this message | ||
Stut wrote:
> Brian Dunning wrote:
>> I just tried that, and unfortunately the MSIE7 toolkit behavior was
>> the same. Darn, I had high hopes for your suggestion as soon as I read
>> it. I fear this means there's little we can do server-side in PHP,
>> except to choose something other than XML for the result.
>
> You should be able to put in your own XSLT that ensures the XML file is
> presented unchanged. Dunno if IE7 will obey it but certainly worth a try.
>
> -Stut
>
I came up against this a while ago, and my work-around was the XSLT solution you
suggest, Stut.
I have a stylesheet called 'copy.xsl', like this:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="UTF-8" standalone="yes"
media-type="text/html" doctype-public="-//W3C//DTD HTML 4.01//EN"/>
<xsl:template match="/">
<xsl:copy-of select='.'/>
</xsl:template>
</xsl:stylesheet>
and then insert
<?xml-stylesheet type='text/xsl' href='copy.xsl'?>
into the XML I am returning - you'd have to make sure that the href actually
points to your file with an absolute URL, to be certain...
That seems to work - IE7 sees the xml-stylesheet PI and doesn't then try to
mangle the XML in it's own special way. Only problem is the extra hit on the
server to get the XSLT... :(
--
Peter Ford phone: 01580 893333
Developer fax: 01580 893399
Justcroft International Ltd., Staplehurst, Kent