XSLT Fundamentals

An XSLT results in the creation of a new XML tree. This clear separation between the source document and the result trees fulfills the goal of XML to separate content from presentation by allowing both the grammar and structure of the XML source to be independent of the presentation language and structure.

At its most basic, XSLT provides a capability similar to a "mail merge." The style sheet contains a template of the desired result structure, and identifies data in the source document to insert into this template. This model for merging data and templates is referred to as the template-driven model and works well on regular and repetitive data. This model will be familiar to users of Active Server Pages (ASPs), which embed bits of script within an HTML template to control processing and insert data. The Microsoft Internet Explorer data binding features also use a template-driven model — elements in the HTML page provide templates for displaying bound data.

XSLT also provides capabilities for handling highly irregular and recursive data, as is typical in documents. Template fragments are defined, and the XSLT processor combines the results of these fragments into a final result tree based on the shape of the source data. Each template fragment declares the type and context of source nodes it is appropriate for, allowing the XSLT processor to match source nodes with template fragments. This model is known as the data-driven model because the shape of the data drives the shape of the final output.

Template-driven and data-driven transformation mechanisms can be combined in a single style sheet, making XSLT appropriate to a wide variety of XML applications.

The following topics will introduce you to the basic XSLT syntax:

You can learn more about the XSLT language from the following topics:

 Last updated on Saturday, April 10, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.