Chrome says: the resource is interpreted as a stylesheet, but is transferred using an application like MIME / xml

I have an XML file that is created using an XSL file. When opening an XML file in Firefox, I have no problem (although, oddly enough, sometimes it appears only after I click "reload"), but in Chrome / Chromium I get an error message:

Resource interpreted as Stylesheet but transferred with MIME type application/xml 

Files here: http://jonreeve.com/test/mike/biblexml.xml

I don’t think there is anything irregular regarding the XML / XSL syntax, and all the links seem to be correctly phrased.

Also, this doesn't seem to be like all the similar questions here that seem to be about javascript and other applications. It is just pure XML / XSL.

+6
source share
2 answers

The XSLT 1.0 specification clearly indicates that the corresponding MIME type for XSLT is text / xml and application / xml

The MIME style types text / xml and application / xml [RFC2376] should be used for XSLT style sheets. It is possible that the media type will be specifically defined for XSLT stylesheets; if and when possible, this type of media can also be used.

In XSLT 2.0, this has been changed to application / xslt + xml .

But

In the absence of a registered material type for XSLT style sheets, some vendor products have adopted various conventions, in particular type = " text / xsl ".

Chrome 32.0.1700.107 returns errors:

The resource is interpreted as a stylesheet, but is migrated with the MIME type text / xml ;

The resource is interpreted as a stylesheet, but is migrated with the MIME type application / xml ;

The resource is interpreted as a stylesheet, but passed with the type MIME application / xslt + xml ;

Chrome does not return an error if the text / xsl is passed.

+4
source

XSLT should be delivered with the MIME type application/xslt+xml , not application/xml . You must configure the server for this. You need a .htaccess file containing the line

 AddType application/xslt+xml .xsl 

This binds the .xsl extension to the correct MIME type. If you already have a .htaccess file in the XSLT directory or in the parent directory, you can add a line. Otherwise, create such a file.

+1
source

All Articles