Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What content-type should be used for XML+XSL presentation?

Tags:

xml

xslt

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).

I want to get rid of this warning message. What content-types should be used for the XML document?

like image 582
yegor256 Avatar asked Jul 16 '11 06:07

yegor256


People also ask

What is XSL how it can be used to present XML?

XSL gives a developer the tools to describe exactly which data fields in an XML file to display and exactly where and how to display them. Like any style sheet language, XSL can be used to create a style definition for one XML document or reused for many other XML documents.

What is XSL file format?

An XSL file is a style sheet that can be used to transform XML documents into other document types and to format the output.

What is used for formatting XML documents?

XSL - More Than a Style Sheet Language XSL-FO - a language for formatting XML documents (discontinued in 2013)


1 Answers

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).

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."

See https://www.rfc-editor.org/rfc/rfc3023#page-16

like image 123
kennethmay Avatar answered Nov 08 '22 21:11

kennethmay