XML+XSL 表示应该使用什么内容类型? [英] What content-type should be used for XML+XSL presentation?
问题描述
我正在尝试在浏览器中呈现 XML+XSL 2.0,返回带有 application/xml
内容类型和 .xsl
的 .xml
页面带有 text/xml
的页面.Safari 抱怨主文档:资源被解释为文档,但使用 MIME 类型 application/xml 传输."(但一直渲染一切都很好).
I'm trying to render XML+XSL 2.0 in browser, returning .xml
pages with application/xml
content type and .xsl
pages with text/xml
. Safari is complaining for the main document: "Resource interpreted as document but transferred with MIME type application/xml." (but keeps rendering everything just fine).
我想去掉这个警告信息.XML 文档应该使用哪些内容类型?
I want to get rid of this warning message. What content-types should be used for the XML document?
推荐答案
我已经成功使用 text/xml
和样式表作为 text/xsl
(或者也许这与 text/xml
一样可以,因为您可以使用它).text/xsl
被广泛认可,但不是官方的"(据我所知).
I've had success using text/xml
with the stylesheet as text/xsl
(or perhaps this is OK as text/xml
as you have it working). text/xsl
is widely recognized, but not "official" (as far as I understand it).
根据 RFC 3023:如果一个 XML 文档,即未经处理的源 XML 文档可供临时用户阅读,text/xml
比 application/xml
更可取>. 不明确支持 text/xml
的 MIME 用户代理(和 Web 用户代理)会将其视为 text/plain,例如,通过将 XML MIME 实体显示为纯文本.<当普通用户无法读取 XML MIME 实体时,最好使用 code>application/xml."
According to RFC 3023: "If an XML document that is, the unprocessed, source XML document is readable by casual users, text/xml
is preferable to application/xml
. MIME user agents (and web user agents) that do not have explicit support for text/xml
will treat it as text/plain, for example, by displaying the XML MIME entity as plain text. application/xml
is preferable when the XML MIME entity is unreadable by casual users."
参见 https://tools.ietf.org/html/rfc3023#page-16
这篇关于XML+XSL 表示应该使用什么内容类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!