To read the article online, visit

Displaying the Data With an XSLT Style Sheet

By Richard Chisholm

This is the second of a series of articles I am writing that deals with using XML and the latest in XSLT technology to create a dynamic web application. My tentative plan for these articles are the following:

    1.) Create an XML document by converting data shaped recordsets with a recursive component. [Read the Article!]
    2.) Getting a more customized XML document by tweaking the SQL statement and the code for the component. [Read the Article!]
    3.) Using XSLT to get a viewable HTML interface in IE5. (This article!)
    4.) A case study using XSLT to create an application that dynamically filters and sorts the XML data.

That may seem like a lot, but that's because there is a whole lot to cover. These articles are designed for ASP programmers with limited XML/XSLT experience, so if you are already familiar with some of this bare with me. I don't think most ASP developers have gone too far in XML, but you can do some really slick things with it, some of which you'll see here. To brush up on your XML, be sure to check out the XML Section on 4Guys!

For parts 1 and 2, you will need IE5 (with the 2.0 MSXML parser), and Visual Basic 6 if you want to edit the source yourself. For parts 3 and 4, you will need IE5 and at least the March preview release for MSXML3. This can be found at and you may want to visit the news group news:// if you have problems getting it to work properly. I found a nifty script that tests if your installation was performed correctly, as well as the info to get MSXML3 working. For the record, the component was developed and tested on a NT Workstation with the IE5 MSXML processor, while the XSLT used in parts 3 and 4 was created on a Win98 machine loaded with IE 5.01 and the March release of MSXML3, using the Athens XML Editor.

Well it's been a while, but I'm finally back with part three. To refresh your memory, last time (read the article, Customizing the COMponent to Create an XML Structure) I showed how my component that converts hierarchical recordsets into XML can be customized to fit a desired format and structure. In this article I will discuss the end result, a web page with an easy to use interface where every order and product can be viewed without any extra trips to the server. I will try to explain everything in a way that is understandable to beginning XSL readers and assume knowledge of XSL formatting and structure rules. Although many XSL articles I have seen discuss converting XML documents into documents with different structures, here I will discuss how to use XSLT style sheets to display data in IE5.

As you probably know, XSLT (Extensible Style Sheet Language: Transformations) is a newer implementation of XSL, and includes many more features and better functionality. Although standard XSL files can be used with IE5, for this article you will need IE5 and at least the March Preview Release of Microsoft's MSXML3 parser. This can be obtained at While at this page there is one add-in that I recommend, the "Internet Explorer Tools for Validating XML and Viewing XSLT Output." This allows you to view the HTML output of the style sheet, which can be very helpful while troubleshooting, by right-clicking on the mouse. Finally, I will be using this XML file (view it in text format) and this version of the component. The SQL statement used is slightly different from the three already shown in the previous source code samples, but will be included here with everything else from the article.

The Component
Before getting into the XSL however, the code to add a reference to a style sheet needs to be added to the component. The createProcessingInstruction method must be used before the first element is created. Here is the code:

Set XMLInstruct = XMLDoc.createProcessingInstruction("xml:stylesheet", " type=""text/xsl"" href=""style.xsl""")
XMLDoc.appendChild XMLInstruct
Set XMLInstruct = Nothing

Notice the second string contains the link and a type declaration. It may look funny, but when creating a processing instruction, you must include all attributes in that statement. If the type is not included, the XSL file won't be used. Just insert this line below the existing XML instruction code.

In Part 2 we'll delve into the specifics of the component, starting out with a look at the XSLT stylesheet!

  • Read Part 2!

  • Article Information
    Article Title: Displaying the Data With an XSLT Style Sheet
    Article Author: Richard Chisholm
    Published Date: Tuesday, October 10, 2000
    Article URL:

    Copyright 2019 QuinStreet Inc. All Rights Reserved.
    Legal Notices, Licensing, Permissions, Privacy Policy.
    Advertise | Newsletters | E-mail Offers