This section provides a tutorial example on how to a first XSLT stylesheet, hello.xls, to transform the original XML document, hello.xml. The Internet Explorer (IE) can be used as XSLT transformation program to apply the stylesheet and generate the resulting document.
Here is the XSLT stylesheet file, hello.xsl, that defines how information in my hello.xml
should be transformed:
Prefix "xls:" is associated with the XML name space: "http://www.w3.org/1999/XSL/Transform".
This is done by the attribute, "xmlns:xsl" in the root element.
In order to link hello.xsl to hello.xml, I have to modify it as hello_xsl.xml:
Note that a new processing instruction "xml-stylesheet" is added to the XML file
to tell the processing applications to look for style instructions in "hello.xsl".
The next question is then: "Do we have an application that can process this XML file
based on the style instructions specified in the XSL file?"
The answer is yes. Microsoft Internet Explorer (IE) 6.0 is an excellent XML XSL processor.
So if you run IE 6.0 and open hello_xsl.xml, you will see the following text in the IE window:
Hello world! - From hello.xsl.
Note that:
The element "p" in hello.xml was transformed into a new text string by IE.
IE first transformed the content in hello_xsl.xml, kept the result in memory,
then displayed the result on the screen.