I have an XML file which is styled using an XSL file. When opening the XML file in Firefox, I get no problems, (although strangely, sometimes it will only display after I hit "reload"), but in Chrome/Chromium I get the error message:
Resource interpreted as Stylesheet but transferred with MIME type application/xml
The files are up here: http://jonreeve.com/test/mike/biblexml.xml
I don't think there's anything irregular about the XML/XSL syntax, and the links all seem to be worded correctly, too.
Furthermore, this doesn't seem to be similar to all the similar-looking questions here, which seem to be dealing with javascript and other applications. This one is just pure XML/XSL.
The XSLT 1.0 spec clearly states that the appropriate MIME type for XSLT is text/xml and application/xml
The MIME media types text/xml and application/xml [RFC2376] should be used for XSLT stylesheets. It is possible that a media type will be registered specifically for XSLT stylesheets; if and when it is, that media type may also be used.
In XSLT 2.0 this was changed to application/xslt+xml.
But
In the absence of a registered media type for XSLT stylesheets, some vendors' products have adopted different conventions, notably type="text/xsl".
Chrome 32.0.1700.107 returns errors:
Resource interpreted as Stylesheet but transferred with MIME type text/xml;
Resource interpreted as Stylesheet but transferred with MIME type application/xml;
Resource interpreted as Stylesheet but transferred with MIME type application/xslt+xml;
Chrome returns no error if text/xsl type passed.
XSLT should be delivered with MIME type application/xslt+xml
, not application/xml
. You should configure your server to do so. You need a .htaccess
file that contains the line
AddType application/xslt+xml .xsl
This associates the extension .xsl
with the correct MIME type. If you already have a .htaccess
file in the XSLT's directory or in a parent directory, you can add the line. Otherwise, create such a file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With