Monday 14 November 2011

How can an XML document be best presented?


An XML document can be presented by styling it with CSS, but XSLT ( Extensible Stylesheet Language Transformation ) is preferred. XSLT is a language which itself is XML, and can be used for a number of transformations of XML documents.

One common application of XSLT is for transforming an XML document into HTML, which will be presented to the user. The advantages of this approach are obvious; it allows a straightforward way of presenting content, as opposed to the more traditional way of storing data in a database, extracting it, and generating HTML from it. Using XSLT represents a simpler solution, and therefore less room for errors.

XSLT can also be used to target various displays, or can be used in combination with XSL Formatting Objects to generate files in a variety of formats, including PDF documents and PNG images. One of the main advantages of using XSLT is that XSLT processors can be either client-side, or server-side.

The presentation of XML documents, transformed using XSLT is not limited to websites; XSLT transformations are supported by Windows XP ( via MSXML3 ) and the GNOME desktop environment for Linux. XSLT fully leverages the advantages offered by being written in XML – it is a widely available and versatile technology, that can be adapted to various purposes, and parsers are relatively easy to write because of the numerous existing applications.