Apply an XSL Filter to an XML Document

I copied an XML document and an XSL document out of my XML for Dummies book. It said that to make the XSL document affect the XML document, I had to use a script and the object tag in HTML, and I had to get something from a CAB file from the Microsoft server. When I viewed the page it said “undefined.” How can I apply an XSL document to an XML one?


There are a couple of different ways that you can “apply” an XSL document to an XML one, depending upon what you are trying to do. If you simply want the XML document to always use the XSL filter as a style sheet (somewhat analogous to CSS), then you can simply place a header for the XSL document as a namespace link:

However, one of the benefits for using XSL style sheets as independent entities is that you can apply different style sheets, depending upon the desired output. Using the MSXML DOM, you can accomplish this through the transformNode() function. In an IE5 Web page, you could output this as follows:

You should never explicitly need a CAB file when working with IE5 for the XML capabilities, as those files are already implicitly available in the IE5 download.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin


Recent Articles: