Magazine |
| | Community |
| | Workshop |
| | Tools & Samples |
| | Training |
| | Site Info |
|
|
||||||||
|
Microsoft® Internet Explorer 5 Beta supports direct browsing of XML source files using XSL or cascading style sheets, just as users can browse HTML documents. For example, users can add XML files to their Favorites folder and can inspect XML files in the History list.
XML file authors specify the CSS or XSL style sheet to be used for displaying the XML file by using the notation described in the World Wide Web Consortium (W3C) note, http://www.w3.org/TR/NOTE-xml-stylesheet. The XML file contains a processing instruction of the form:
<?xml:stylesheet type="typevalue" href="urlvalue"?>
The value of the type attribute can be set to the literal string "text/css" to select CSS processing, or "text/xsl" to select XSL processing.
For example, in the following fragment, the file "spec.xsl" is specified as the XSL style sheet:
When both CSS and XSL style-sheet processing instructions (PIs) are present, the XSL style sheet is selected. When multiple XSL style-sheet processing instructions are present, the first is selected and the others are ignored.
When no style sheet is specified in the XML source, the browser applies a default XSL style sheet to perform the transformation.
The browser displays informative error messages when errors occur. For example, Internet Explorer 5 Beta reports load errors (the XML source or XSL style sheet is not well-formed or not valid), XSL run-time errors, and security violations.
The XSL style sheet must come from the same scheme (example: "http") and host name (example: www.microsoft.com) as the XML source. The XSL style-sheet download follows the same security policies as those for fetching an external entity. Attempting to read a style sheet from a different domain results in an access violation error.
When using an XSL style sheet, you can access the XML source through the XML Document Object Model (DOM). Two additional properties are exposed on the document object from DHTML: document.XMLDocument and document.XSLDocument. The XMLDocument property returns the root of the XML source tree, and the XSLDocument property returns the root of the XSL style sheet.
The XML DOM properties return IXMLDOMDocument (DOMDocument) objects. For more information about the XML DOM, see the XML DOM Reference.
For more information about XSL, see the XSL Reference.
When CSS style-sheet and alternate style-sheet PIs are present, the behavior is the same as the HTML LINK element.
For more information about CSS, please see the CSS documentation.When CSS processing is selected, the HTML namespace must be declared using xmlns:html="uri:html" on the root element of the XML file. Elements with the html prefix can then be treated as HTML elements.
Note that when using CSS style sheets, the implementation provided in this release imposes two restrictions on namespaces: All namespace declarations must be on the root element of the XML source file, and default namespace declarations (allowing use of the namespace elements without prefixes) are not supported.
When you install Microsoft Internet Explorer 5 Beta, its setup program performs all registration needed to support direct browsing of XML files. The XML source files have the MIME type "text/xml" or "application/xml", as described in the
IETF RFC2376. CSS style sheets have the MIME type "text/css", and XSL style sheets have the MIME type "text/xsl".
Does this content meet your programming needs? Write us!
© 1998 Microsoft Corporation. All rights reserved. Terms of use.