Using an External Style Sheet


In addition to its default style sheet, Microsoft® Internet Explorer supports style sheets written as either cascading style sheets or XSLT files. To use one of these style sheets to display an XML document, you must include a style sheet processing instruction in the XML document that indicates the type and location of the style sheet.


Although Internet Explorer automatically uses the style sheet processing instruction to display XML directly in the browser, other uses of XML, such as data islands, ignore this instruction.

A style sheet processing instruction must be at the beginning of an XML document, following the XML declaration (if there is one) and the document type declaration (if there is one), as shown in the following XML document.

<?xml version="1.0" ?>
<!DOCTYPE region >
<?xml-stylesheet type="text/css" href="region.css" ?>
   <name>Western Region</name>
   <quarter number="1" books_sold="24000"/>
   <quarter number="2" books_sold="38600"/>

An XML document can include multiple style sheet processing instructions. Internet Explorer looks first for a processing instruction of type text/xsl and uses the first one it finds. Otherwise, it searches for text/css processing instructions and cascades them together using the same process as the HTML <LINK> element. Other attributes that are allowed on the <LINK> element can also be specified in the style sheet processing instruction.

See Also

Using the Default Style Sheet