XSLT Requirements for Viewing XML in a Browser
XSLT files that display an XML file in a Web browser have stricter requirements than those used for transforming XML to a general HTML file. For more information about authoring an XSLT style sheet, see Template-Driven Transformations. When authoring a style sheet for use in direct browsing, be aware of the following limitations.
- The style sheet must target HTML as its output.
- The style sheet applies to the root of the source document. Style sheets written to process against the document element will generally not display correctly. For information about the difference between the document root and the document element, see How the DOM Defines the Context for XPath Expressions.
- The XSLT style sheet must come from the same URL scheme (for example, http) and host name (for example, www.microsoft.com) as the XML source. The 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 unless the security option Access data across domains is selected from the Internet Options dialog box.
Microsoft® Internet Explorer 5.0 uses a style sheet to display an XML document when that document contains a style sheet processing instruction with type "text/xsl"
. The following example specifies that the document should be processed with review.xsl.
<?xml-stylesheet type="text/xsl" href="review.xsl" ?>