About XSLT

XSLT (Extensible Stylesheet Language Transformations) is a declarative, XML-based language used for the transformation of XML documents. The original document is not changed; rather, a new document is created based on the content of an existing one.[2] The new document may be serialized (output) by the processor in standard XML syntax or in another format, such as HTML or plain text.[3] XSLT is most often used to convert data between different XML schemas or to convert XML data into web pages or PDF documents.”
XSLT @ Wikipedia

XSLT process overview

XSLT Process DiagramThis diagram illustrates the XSLT process.

  • An XML input provides some data.
    • XML web service, or XML file
  • XSLT code provides instructions for transforming the XML data into another format.
    • XSLT code is based on XML
    • XSLT files have either .xsl or .xslt extension
    • An XSLT file can represent an entire document, or a fragment
  • An XSLT processor runs the XSLT code, using the XML data, to create a Result document.
    • XSLT processor is typically server-side language such as PHP, ASP, ColdFusion
    • Result document can be an entire document, or a fragment of content within a larger document

A typical example

A user browses a PHP page. Along with static HTML, the page contains some PHP code. The PHP code processes the XSLT fragment using the XML data source. The XML data source provides blog post summaries. The “result document”, in this case, is a block of HTML summarizing the latest blog posts.

XSLT Expressions

Expressions are used in XSLT code for a variety of purposes including:

  • selecting nodes for processing;
  • specifying conditions for different ways of processing a node;
  • generating text to be inserted in the result tree.

Expressions occur:

  • as the value of certain attributes on XSLT-defined elements;
  • within curly braces {} in attribute value templates.

XSLT @ w3.org