An XSL transformation 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 the structure of the XML source to be independent of the presentation language and structure.
XSL at its most basic 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, which embed bits of script within an HTML template to control processing and to 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.
XSL also provides capabilities for handling highly irregular and recursive data such as is typical in documents. Template fragments are defined, and the XSL 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 XSL processor to match source nodes with template fragments. This model is known as the data-driven model since 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 XSL appropriate to a wide variety of XML applications.
These topics will introduce you to the basic XSL syntax:
You can continue to learn more about the XSL language by exploring these topics: