Поделиться через


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. 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.

  • 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 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" ?>