Click to return to the XML (Extensible Markup Language) home page    
Parameterizing a Style Sh...     Using the XSL Processor    
Web Workshop  |  XML (Extensible Markup Language)

Using the Default XSL Style Sheet in Your Application


When browsing directly to an XML file that does not specify a style sheet, Microsoft® Internet Explorer 5 provides a default view of the XML using a built-in XSL style sheet. This default style sheet provides a collapsible hierarchy with color-coding of the xsl, xml, xmlns, and dt namespaces.

This style sheet is available to incorporate into your applications. Download a copy of it at Downloadable Default Style Sheet. For instance, in the following example, the default style sheet is used on a data island within an HTML page.

<HTML>
  <SCRIPT>
    function display()
    {
      rawdata.document.write(data.transformNode(defaultss.XMLDocument));
      stylesheet.document.write(ss.transformNode(defaultss.XMLDocument));
      data.transformNodeToObject(ss.XMLDocument, resultTree.XMLDocument);
      result.document.write(resultTree.xml);
      resultsrc.document.write(resultTree.transformNode(defaultss.XMLDocument));
    }
  </SCRIPT>
  
  <SCRIPT FOR="window" EVENT="onload">
    display();
  </SCRIPT>
  
  <XML id="data" src="auction1.xml"></XML>
  <XML id="ss" src="summary.xsl"></XML>
  <XML id="defaultss" src="defaultss.xsl"></XML>
  <XML id="resultTree"></XML>

  <FRAMESET COLS="180,*" ROWS="*,*,*,*" FRAMEBORDER="1" FRAMESPACING="5"
      BORDERCOLOR="black">
    <FRAME ID="rawdataHeader" src="rawdataHeader.htm">
    <FRAME ID="rawdata">
    <FRAME ID="stylesheetHeader" src="stylesheetHeader.htm">
    <FRAME ID="stylesheet">
    <FRAME ID="resultsrcHeader" src="resultSrcHeader.htm">
    <FRAME ID="resultsrc">
    <FRAME ID="resultHeader" src="resultHeader.htm">
    <FRAME ID="result">
  </FRAMESET>
</HTML>

Try it! The above example is part of the Transformation Viewer.

Download Download this sample.

Note This style sheet is also available directly as a resource on Internet Explorer 5 clients. The URL for accessing this resource locally is res://msxml.dll/DEFAULTSS.XSL. Loading this URL makes the style sheet available for use by transformNode. Security restrictions do not allow this URL to be used when the containing page is accessed via URLs with the http:// or https:// schemes.



Back to topBack to top

Did you find this topic useful? Suggestions for other topics? Write us!

© 1999 Microsoft Corporation. All rights reserved. Terms of use.