Using an External Style Sheet

MSXML 5.0 SDK

Microsoft XML Core Services (MSXML) 5.0 for Microsoft Office - XSLT Developer's Guide

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.

Note   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" ?>
<region>
   <name>Western Region</name>
   <quarter number="1" books_sold="24000"/>
   <quarter number="2" books_sold="38600"/>
</region>

An XML document can include multiple style sheet processing instructions. Internet Explorer 5.0 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.

For the World Wide Web Consortium (W3C) recommendation for style sheet processing instruction syntax, see Associating Style Sheets with XML Documents Other Resources.

See Also

Using the Default Style Sheet