Unlike HTML, XML does not predefine display properties for specific elements. Thus it requires a separate style sheet to contain the descriptions of how the XML should be displayed. This separation of the XML content from its presentation allows the content to be easily repurposed. Microsoft® Internet Explorer supports style sheets written in either CSS or XSL.
You can enable an XML document for browsing by indicating the type and location of a style sheet with the style sheet processing instruction (style sheet PI). The World Wide Web Consortium (W3C) Recommendation for style sheet PI syntax can be found at http://www.w3.org/TR/WD-xml-stylesheet . The basic form of the style sheet PI looks like this:
<?xml-stylesheet type="text/xsl" href="mystyle.xsl"?>
When Internet Explorer browses to the XML document, it looks for this PI and downloads the style sheet as well and uses it to display the XML. Note that the style sheet PI is used automatically only when displaying the XML directly in the browser. Other uses of XML such as data islands ignore the PI.
Each style sheet PI must have the type attribute. The values of this attribute describe the type of style sheet to apply: "text/css" indicates a CSS style sheet, and "text/xsl" indicates an XSL style sheet.
The href attribute is a URL to the style sheet. Relative URLs are evaluated relative to the URL of the XML document.
An XML document can include multiple style sheet PIs. Internet Explorer 5 looks first for a PI of type "text/xsl" and uses the first one it finds. Otherwise it searches for "text/css" PIs 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 PI. These are either ignored in the case of XSL or treated the same as corresponding elements on the HTML <LINK> element.
If you browse to an XML document that doesn't contain a valid style sheet PI, Internet Explorer 5 will display the XML as an expanding and collapsing tree. This provides a convenient way for XML authors to check that their XML is well-formed. You can also test XSL style sheets and XML Schema documents for well-formedness by opening them in the browser.
To test a document, simply double-click the XML document or type its URL into the address bar of the browser. Well-formedness errors will be reported complete with line numbers to help you find and correct the error. At times you might want to comment out any style sheet PIs in the source document to isolate source errors from style sheet errors.
Internet Explorer displays XML documents asynchronously. This means that it begins displaying the XML document before the document has been completely downloaded. When an error occurs towards the end of a long document, Internet Explorer 5 might have already displayed much of the document. In this case the error message is inserted directly into the document, and you can view it by scrolling to the bottom of the page.
Here are some examples that use the default style sheet to check for well-formedness:
When directly browsing XML documents, Internet Explorer 5 loads the specified Document Type Definition (DTD) or XML Schema, but does not report validation errors.