Several possibilities exist to read XML files. One such possibility is to have it read via XSLT. This procedure is composed of three elements:
- The XML file that is to be read;
- A XSLT file that provides us with instructions on how to handle the XML file.
- An engine that translates the XML file via the instructions as given in the XSLT file into something that is readable.
An example may clarify this. Suppose, we have a XML file that starts with these lines:
For a full XML file see here. Within this XML file, it is indicated that an XSLT file “cdcatalog.xsl” is to used as a file that contains instructions on how to read this XML file. In this case, the set of instructions looks like: .
If the XML file is then accessed with a programme that contains an engine to apply the instructions as contained in the XSLT, we get the desired result. Every modern web browser contains such engine. Hence if the web browser is used to read the XML file, we already have the desired result. This is how I could see the XML file when I read this with my webbrowser:
Below, I have included a link where three scripts are executed.
If the reader would like to see the scripts, he could look at the source that can be read from the web browser itself. After all, the script must be read by the web browser as to execute it in the browser.
It is also nice to see that the scripts are interpreted differently by different web browser. The Internet Explorer will give another result as, say, the Chrome browser. This shows that the scripts are interpreted by the web browser and we have the consequences of different web browser and ensuing different results.