Chrome 说:资源被解释为样式表但使用 MIME 类型 application/xml 传输 [英] Chrome says: Resource interpreted as Stylesheet but transferred with MIME type application/xml

查看:80
本文介绍了Chrome 说:资源被解释为样式表但使用 MIME 类型 application/xml 传输的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用 XSL 文件设计的 XML 文件.在 Firefox 中打开 XML 文件时,我没有遇到任何问题(虽然奇怪,有时它只会在我点击重新加载"后才显示),但在 Chrome/Chromium 中我收到错误消息:

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

文件在这里:http://jonreeve.com/test/mike/biblexml.xml

我不认为 XML/XSL 语法有任何不规则之处,而且链接的措辞似乎也都正确.

I don't think there's anything irregular about the XML/XSL syntax, and the links all seem to be worded correctly, too.

此外,这似乎与这里所有看起来相似的问题都不相似,这些问题似乎是在处理 javascript 和其他应用程序.这只是纯粹的 XML/XSL.

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.

推荐答案

XSLT 1.0 规范明确指出 XSLT 的适当 MIME 类型是text/xmlapplication/xml

The XSLT 1.0 spec clearly states that the appropriate MIME type for XSLT is text/xml and application/xml

MIME 媒体类型 text/xml 和 application/xml [RFC2376] 应该用于XSLT 样式表.可能会专门为 XSLT 样式表注册媒体类型;如果需要,也可以使用该媒体类型.

XSLT 2.0 中已更改为 application/xslt+xml.

但是

由于没有 XSLT 样式表的注册媒体类型,一些供应商的产品采用了不同的约定,特别是 type="text/xsl".

Chrome 32.0.1700.107 返回错误:

Chrome 32.0.1700.107 returns errors:

资源被解释为样式表,但以 MIME 类型text/xml传输;

Resource interpreted as Stylesheet but transferred with MIME type text/xml;

资源被解释为样式表但以 MIME 类型传输application/xml;

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

资源被解释为样式表,但以 MIME 类型传输 application/xslt+xml;

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

如果 text/xsl 类型通过,Chrome 不会返回错误.

Chrome returns no error if text/xsl type passed.

这篇关于Chrome 说:资源被解释为样式表但使用 MIME 类型 application/xml 传输的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆