warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in C:\inetpub\Websites\DevGuru\www\includes\common.inc(1762) : eval()'d code on line 1.

XSLT » Introduction

Download free PDF version

Welcome to the DevGuru XSLT Quick Reference guide. This is a comprehensive 101-page reference source for all of the elements and functions that compose the eXtensible Stylesheet Language Transformation (XSLT) language version 1.0. This Quick Reference features real working code examples which were tested using the Microsoft XML parser version 3.0.

XML is one of the most important of all recent innovations to hit the web. The XML technology provides a means of storing data in a structured manner. If you are not familiar with XML and would like an introduction, the Guru strongly recommends that you read the following two-part tutorial:

A Beginners Guide to Creating and Displaying Your First XML Document.

The question (and programming challenge!) is how to access and display the information contained in an XML file. After all, data is useless unless you can use it. This is where XSLT comes into the picture.

A comparison can be made between the relationship of CSS and HTML and the relationship of XSLT and XML. Indeed, XSLT is usually referred to as the stylesheet language of XML, however XML and XSLT are far more sophisticated technologies than HTML and CSS.

XSLT is a high-level declarative language. It is also a transforming and formatting language, and that describes exactly how XSLT behaves:

  • First, the pertinent data is extracted from an XML source document and then it is transformed into a new data structure that reflects the desired output. (The results of this XSLT transformation is commonly called a stylesheet.) A parser is used to convert the XML document into a tree structure which is composed of various types of nodes. The transformation is accomplished with XSLT by using pattern matching and templates. Patterns are matched against the (source) tree structure and templates are used to create a result tree.
  • Next, the new data structure is formatted, for example in HTML or as text, and finally the data is ready for display.
Note that XSLT only manipulates the source tree and that the original XML document is left unchanged.

The most important aspect of XSLT is that it allows you to perform extremely complex manipulations on the selected tree nodes by affecting both content and appearance. Indeed, the final output may bear absolutely no resemblance to the source document. This ability to manipulate the nodes is where XSLT leaves CSS back in the dust.