Apply an XSL Filter to an XML Document

Apply an XSL Filter to an XML Document

Question:
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?

Answer:

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:
data observability

Data Observability Explained

Data is the lifeblood of any successful business, as it is the driving force behind critical decision-making, insight generation, and strategic development. However, due to its intricate nature, ensuring the

Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular