3.6 Media Types

The last attribute I'll mention is media-type. This attribute allows you to set the media type for the result. Media types are also sometimes called MIME types (MIME is short for Multipurpose Internet Mail Extensions), but since the types apply to more than just email, the term media type is more encompassing.

Here is one example fragment. A media type of application/xml may be specified in an output element like this:

<xsl:output output="xml" media-type="application/xml"/>

The value of this attribute, if you use it, will not be reflected explicitly in the result. In fact, the specification makes no stipulations about whether a processor needs to provide this information to an application. Nevertheless, an application might possibly make the media type information available to a server running HTTP, which could then use it in the Content-Type field of an HTTP header. This was probably the intent of this obscure attribute.

Table 3-2 lists the default media types for the three built-in output methods of XSLT.

Table 3-2. Default media types

Method

Default media type

XML

text/xml

HTML

text/html

Text

text/plain



Learning XSLT
Learning XSLT
ISBN: 0596003277
EAN: 2147483647
Year: 2003
Pages: 164

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net