JAG

James Griffiths Ltd

XML & XSL example

 

Information



Please note: You may need Internet Explorer 5.0 or above to view all the documents properly.

The XML data is transformed by the XSL stylesheet. In this case, to be displayed as HTML, but it could well be for any other application or purpose.

The transformation in this case is carried out on the server, so only HTML is returned to the browser and there should be no compatibility problems. 

View the transformation

In the next example the transformation is carried out on client by loading the XML file itself into the browser, and the XML file specifies the XSL file to carry out the transformation.

View the transformation

Syntax

A few important points to note about XML syntax 

All opening tags must have a corresponding closing tag even if they can be omitted in HTML. In HTML you can write

<p>Whatever<p>More

This is not permitted in XML, the closing </p> is required.

If you are using a tag that does not normally have a closing tag, e.g. <hr>, it is written as <hr/>, or <hr></hr>.

XML is case sesitive. This means that the following is incorrect:

<P>Something</p>

It's therefore a good idea to use either all uppercase or all lowercase when creating documents.