XSLT Examples

XSLT stands for XSL Transformations. This examples page shows example uses of XSLT to transform XML documents into other formats, like HTML lists, Java code, and a HTML form. The material on this page is created from heavily modified examples available from the w3schools website.

XML-XSLT Interpreter
An XML-XSLT interpreter allows automated conversion between source data to some useful output using an XSLT template.

Each example of XST Transformations on this page use the XML document people.xml as the source data for their transformations. The XSLT files below each provide a mapping between the XML source data and some useful format.

XSL Transformations on the Client

The main (important) functions used by this script to perform XSL transformation on XML on the client can be found in xmlxslt-loader.js. The two methods are:

loadXML(fname) : XMLDocument

The function loadXML is a slightly modified version of the w3schools xstl on the client example; the method loads a the specified xml, or xslt document.

transformXML(xml, xslt) : DocumentFragment

The function transformXML(xml, xslt) takes either a loaded XML document, or XML filename for both xml and xslt parameters and attempts to perform the XSL transformation. The method returns a document fragment that can be appended to the DOM.

The examples on this page need JavaScript to run, if you don't see several link buttons along the top of the page, then javascript is probably disabled. (Tested in IE7 and FF-2.0)

Author: John Beech, Contact, email to: xslt, mkv25.net