Linking to an XSLT File
There are two way to link an XSLT style sheet to an XML source document:
- Embed the style sheet in the source document using the
<?xml-stylesheet type="text/xsl" href="myxsl.xsl"?>
processing instruction. - Use a script or a COM-enabled programming language to Load the XML and XSLT files into DOM. Call the
transformNode
method to apply the transformation.
From a performance standpoint, it does not matter whether you link using a style sheet processing instruction or using the DOM. The difference between these two methods focuses on the underlying data, as outlined in the following table.
Link Using... | If... |
---|---|
A style sheet processing instruction |
|
The DOM |
|
Note For ease in learning XSLT, many of the samples in this section use a style sheet processing instruction to link to the XSLT file. These samples would work just as well if you linked them using the DOM instead.
See Also
Linking Using a Processing Instruction | Linking Using the DOM | Displaying Transformation Results | The XSLT Processor