Diagram of the basic elements and process flow of Extensible Stylesheet Language Transformations. Extensible Stylesheet Language Transformations (XSLT) is an XML-based language used for the transformation of XML documents into other XML or "human-readable" 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 HTML or XHTML documents for web pages, creating a Dynamic web page, or into an intermediate XML format that can be converted to PDF documents. Image File history File links XSLT.svgâ Dreftymac ImageNode series. ...
A filename extension is a suffix to the name of a computer file applied to show its format. ...
Multipurpose Internet Mail Extensions (MIME) is an Internet Standard that extends the format of e-mail to support: text in character sets other than US-ASCII; non-text attachments; multi-part message bodies; and header information in non-ASCII character sets. ...
A stylesheet language is a computer language used to describe the presentation of structured documents. ...
The Extensible Markup Language (XML) is a general-purpose markup language. ...
Standards are produced by many organizations, some for internal usage only, others for use by a groups of people, groups of companies, or a subsection of an industry. ...
Image File history File links This is a lossless scalable vector image. ...
Image File history File links This is a lossless scalable vector image. ...
The Extensible Markup Language (XML) is a general-purpose markup language. ...
An XML transformation language is a computer language designed specifically to transform an input XML document into an output XML document which satisfies some specific goal. ...
In computer science, in the context of data storage and transmission, serialization is the process of saving an object onto a storage medium (such as a file, or a memory buffer) or to transmit it across a network connection link, either in binary form, or in some human-readable text...
HTML, short for Hypertext Markup Language, is the predominant markup language for web pages. ...
Computer files can be divided into two broad categories: binary and text. ...
An XML schema is a description of a type of XML document, typically expressed in terms of constraints on the structure and content of documents of that type, above and beyond the basic syntax constraints imposed by XML itself. ...
HTML, short for Hypertext Markup Language, is the predominant markup language for web pages. ...
The Extensible HyperText Markup Language, or XHTML, is a markup language that has the same depth of expression as HTML, but also conforms to XML syntax. ...
A screenshot of a web page. ...
In classical hypertext navigation occurs among static documents, and, for web users, this experience is reproduced using static web pages. ...
âPDFâ redirects here. ...
As a language, XSLT is influenced by functional languages,[4] and by text-based pattern matching languages like SNOBOL and awk. Its most direct predecessor was DSSSL, a language that performed the same function for SGML that XSLT performs for XML. XSLT can also be considered as a template processor. Functional programming is a programming paradigm that conceives computation as the evaluation of mathematical functions and avoids state and mutable data. ...
SNOBOL (StriNg Oriented symBOlic Language) is a computer programming language developed between 1962 and 1967 at AT&T Bell Laboratories by David J. Farber, Ralph E. Griswold and Ivan P. Polonsky. ...
AWK is a general purpose computer language that is designed for processing text-based data, either in files or data streams. ...
Document Style Semantics and Specifications Language (DSSSL) is a language for specifying stylesheets for SGML documents, based on a subset of the Scheme programming language. ...
The Standard Generalized Markup Language (SGML) is a metalanguage in which one can define markup languages for documents. ...
A diagram illustrating all of the basic elements and processing flow of a template engine. ...
XSLT is Turing complete.[5][6][7][8] In computability theory a programming language or any other logical system is called Turing-complete if it has a computational power equivalent to a universal Turing machine. ...
Origins
XSLT is developed by the W3C. The current version is XSLT 2.0, which reached W3C recommendation status on 23 January 2007. As of 2007, XSLT 1.0 is more widely used and implemented. (The only implementation of XSLT 2.0 is Saxon 8.9.) The World Wide Web Consortium (W3C) is a consortium that produces standards—recommendations, as they call them—for the World Wide Web. ...
A W3C Recommendation is the final stage of a ratification process of the W3C working group concerning the standard. ...
is the 23rd day of the year in the Gregorian calendar. ...
Year 2007 (MMVII) is the current year, a common year starting on Monday of the Gregorian calendar and the AD/CE era. ...
Saxon is an open-source Java XSLT and XQuery processor created by Michael Kay. ...
Originally, XSLT was part of the W3C's Extensible Stylesheet Language (XSL) development effort of 1998–1999, a project which also produced XSL Formatting Objects (XSL-FO) and the XML Path Language, XPath. The editor of the first version (and in effect, the chief designer of the language) was James Clark. XSLT 1.0 was published as a Recommendation by the W3C on 16 November 1999. After an abortive attempt to create a version 1.1 in 2001, the XSL working group joined forces with the XQuery working group to create XPath 2.0, with a much richer data model and type system based on XML Schema. XSLT 2.0, developed under the editorship of Michael Kay, was built on this foundation in 2002–2006. The eXtensible Stylesheet Language (XSL) is a family of transformation languages which allows one to describe how files encoded in the XML standard are to be formatted or transformed. ...
XSL Formatting Objects, or XSL-FO, is an XML markup language for document formatting. ...
XPath (XML Path Language) is an expression language for addressing portions of an XML document, or for computing values (strings, numbers, or boolean values) based on the content of an XML document. ...
Clark, (February 23, 1964) is the author of groff and expat and has done much work with open-source software and XML. Born in London, Charterhouse School|Charterhouse]] and Merton College, Oxford, Clark has lived in Bangkok, Thailand since 1995, and is now a permanent resident. ...
is the 320th day of the year (321st in leap years) in the Gregorian calendar. ...
This article is about the year. ...
XQuery is a query language (with some programming language features) that is designed to query collections of XML data. ...
XPath 2. ...
An XML schema is a description of a type of XML document, typically expressed in terms of constraints on the structure and content of documents of that type, above and beyond the basic syntax constraints imposed by XML itself. ...
Michael Kay, (11 October 1951) is the editor of the W3C specification of the XSLT 2. ...
Most of this article is applicable to both XSLT versions; any differences are noted in the text.
Overview The XSLT processing model involves: - one or more XML source documents;
- one or more XSLT stylesheet modules;
- the XSLT template processing engine (the processor); and
- one or more result documents.
Technically, the term document here means a tree conforming to the XPath data model. In practice these documents will often be files containing lexical XML, but the specifications are careful not to rule out other representations, for example in-memory trees or streams of events. The XSLT processor ordinarily takes two input files[9] – an XML source document, and an XSLT stylesheet – and produces an output document. The XSLT stylesheet contains the XSLT program text (or ‘source code’ in other languages) and is itself an XML document that describes a collection of template rules: instructions and other hints that guide the processor toward the production of the output document.
Template rule processing The XSLT language is declarative — rather than listing an imperative sequence of actions to perform in a stateful environment, template rules only define how to handle a node matching a particular XPath-like pattern if the processor should happen to encounter one, and the contents of the templates effectively comprise functional expressions which directly represent their evaluated form: the result tree, which is the basis of the processor's output. Functional programming is a programming paradigm that conceives computation as the evaluation of mathematical functions and avoids state and mutable data. ...
An expression in a programming language is a combination of values and functions or procedures, interpreted according to the particular rules of precedence and of association for a particular programming language, which computes and then returns another value. ...
The processor follows a fixed algorithm: Assuming a stylesheet has already been read and prepared, the processor builds a source tree from the input XML document. It then starts by processing the source tree's root node, finding in the stylesheet the best-matching template for that node, and evaluating the template's contents. Instructions in each template generally direct the processor to either create nodes in the result tree, or process more nodes in the source tree in the same way as the root node. Output is derived from the result tree. In computer science, a tree is a widely-used computer data structure that emulates a tree structure with a set of linked nodes. ...
Processor implementations XSLT processor implementations fall into two main categories: server-side, and client-side. Although client-side XSLT processing has been available in Microsoft's Internet Explorer since 1999 (or even earlier, but in a form that was incompatible with the W3C specifications), adoption has been slower because of the widespread deployment of older and alternative browsers without XSLT support. For similar reasons, adoption of XSLT 2.0 in such environments is likely to be some years away. Microsoft Corporation, (NASDAQ: MSFT, HKSE: 4338) is a multinational computer technology corporation with global annual revenue of US$44. ...
Windows Internet Explorer (formerly Microsoft Internet Explorer, abbreviated MSIE), commonly abbreviated to IE, is a series of proprietary graphical web browsers developed by Microsoft and included as part of the Microsoft Windows line of operating systems starting in 1995. ...
This article is about the year. ...
XSLT processors may be delivered as standalone products, or as components of other software including web browsers, application servers, frameworks such as Java and .NET, or even operating systems. For example, Windows XP comes with the MSXML3 library, which includes an XSLT processor. Earlier versions may be upgraded and there are many alternatives, see the External Links section. Windows XP is a line of operating systems developed by Microsoft for use on general-purpose computer systems, including home and business desktops, notebook computers, and media centers. ...
Microsoft XML Core Services (MSXML) is a set of services that allow applications written in JScript, VBScript and Microsoft Visual Studio 6. ...
Performance The performance of XSLT processors has steadily improved as the technology has become more mature, although the very first processor, James Clark's xt, was unbeaten for several years. Most of the earlier XSLT processors were interpreters; in more recent products, code generation is increasingly common, using portable intermediate languages such as Java bytecode or .NET Common Intermediate Language as the target. However, even the interpretive products generally offer separate analysis and execution phases, allowing an optimized expression tree to be created in memory and reused to perform multiple transformations: this gives substantial performance benefits in online publishing applications where the same transformation is applied many times per second to different source documents.[10] This separation is reflected in the design of XSLT processing APIs such as JAXP (Java API for XML Processing). The Java API for XML Processing, or JAXP, is one of the Java XML programming APIs. ...
Early XSLT processors had very few optimizations; stylesheet documents were read into Document Object Models and the processor would act on them directly. XPath engines were also not optimized. Increasingly, however, XSLT processors use the kind of optimization techniques found in functional programming languages and database query languages, notably static rewriting of the expression tree for example to move calculations out of loops, and lazy pipelined evaluation to reduce the use of memory for intermediate results and allow "early exit" when the processor can evaluate an expression such as following-sibling::*[1] without a complete evaluation of all subexpressions. Many processors also use tree representations that are much more efficient (in both space and time) than general purpose DOM implementations. // Hierarchy of Objects in the DOM - Document Object Model The Document Object Model (DOM) is a platform- and language-independent standard object model for representing HTML or XML and related formats. ...
XPath (XML Path Language) is an expression language for addressing portions of an XML document, or for computing values (strings, numbers, or boolean values) based on the content of an XML document. ...
XSLT and XPath XSLT relies upon the W3C's XPath language for identifying subsets of the source document tree, as well as for performing calculations. XPath also provides a range of functions, which XSLT itself further augments. This reliance upon XPath adds a great deal of power and flexibility to XSLT. XPath (XML Path Language) is an expression language for addressing portions of an XML document, or for computing values (strings, numbers, or boolean values) based on the content of an XML document. ...
In computer science, a subroutine (function, method, procedure, or subprogram) is a portion of code within a larger program, which performs a specific task and is relatively independent of the remaining code. ...
XSLT 2.0 relies on XPath 2.0; both specifications were published on the same date. Similarly, XSLT 1.0 works with XPath 1.0.
Examples Sample of incoming XML document <?xml version="1.0" ?> <persons> <person username="JS1"> <name>John</name> <family_name>Smith</family_name> </person> <person username="MI1"> <name>Morka</name> <family_name>Ismincius</family_name> </person> </persons> Example 1 (transforming XML to XML) This XSLT stylesheet provides templates to transform the XML document: <?xml version="1.0" ?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="xml" indent="yes"/> <xsl:template match="/"> <root> <xsl:apply-templates/> </root> </xsl:template> <xsl:template match="//person"> <name username="{@username}"> <xsl:value-of select="name" /> </name> </xsl:template> </xsl:stylesheet> Its evaluation results in a new XML document, having another structure: <?xml version="1.0" encoding="UTF-8"?> <root> <name username="JS1">John</name> <name username="MI1">Morka</name> </root> Example 2 (transforming XML to XHTML) Example XSLT Stylesheet: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="/persons"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Testing XML Example</title> </head> <body> <h1>Persons</h1> <ul> <xsl:apply-templates select="person"> <xsl:sort select="family_name" /> </xsl:apply-templates> </ul> </body> </html> </xsl:template> <xsl:template match="person"> <li> <xsl:value-of select="family_name"/>, <xsl:value-of test select="name"/> </li> </xsl:template> </xsl:stylesheet> XHTML output that this would produce (whitespace has been adjusted here for clarity): For other uses, see white space. ...
<?xml version="1.0" encoding="UTF-8"?> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Testing XML Example</title> </head> <body> <h1>Persons</h1> <ul> <li>Ismincius, Morka</li> <li>Smith, John</li> </ul> </body> </html> | |
How the XHTML appears when rendered in a web browser. | Image File history File links No higher resolution available. ...
An example of a Web browser (Internet Explorer 7) A Web browser is a software application that enables a user to display and interact with text, images, and other information typically located on a Web page at a website on the World Wide Web or a local area network. ...
References See also To meet Wikipedias quality standards, this article or section may require cleanup. ...
This article lists some of the elements used in XSLT. // <xsl:stylesheet> <xsl:template match=//input> <xsl:variable name=type select=@type/> <xsl:variable name=name select=@name/> <xsl:if test=$type=text or $type=password or $type=radio or $type=checkbox> <xsl:choose> <xsl:when test=$type=radio> <select...
An XML transformation language is a computer language designed specifically to transform an input XML document into an output XML document which satisfies some specific goal. ...
The eXtensible Stylesheet Language (XSL) is a family of transformation languages which allows one to describe how files encoded in the XML standard are to be formatted or transformed. ...
XQuery is a query language (with some programming language features) that is designed to query collections of XML data. ...
A XML template engine (or XML template processor) is a specialized Template processor for XML input and/or XML output, working in a XML template system context. ...
Tree programming refers to the use of a programming language to analyze data trees, in a way unique from conventional programming languages. ...
In metadata, the identity transform is an example of a data transformation that copies the source data into the destination data without change. ...
Apache Cocoon, often just called Cocoon, is a web development framework built around the concepts of separation of concerns and component-based web development. ...
âJava languageâ redirects here. ...
External links - For implementations, see XML template engine.
- Documentation
- Mailing lists
- Books
- XSLT by Doug Tidwell, published by O’Reilly (ISBN 0-596-00053-7)
- XSLT Cookbook by Sal Mangano, published by O’Reilly (ISBN 0-596-00974-7)
- XSLT 2.0 Programmer's Reference by Michael Kay (ISBN 0-764-56909-0)
- XSLT 2.0 Web Development by Dmitry Kirsanov (ISBN 0-13-140635-3)
- XSL Companion, 2nd Edition by Neil Bradley, published by Addison-Wesley (ISBN 0-201-77083-0)
- XSLT and XPath on the Edge (Unlimited Edition) by Jeni Tennison, published by Hungry Minds Inc, U.S. (ISBN 0-7645-4776-3)
- XSLT & XPath, A Guide to XML Transformations by John Robert Gardner and Zarella Rendon, published by Prentice-Hall (ISBN 0-13-040446-2)
- XSLT code libraries
- EXSLT is a widespread community initiative to provide extensions to XSLT.
- FXSL is a library implementing support for Higher-order functions in XSLT. FXSL is written in XSLT itself.
- The XSLT Standard Library xsltsl, provides the XSLT developer with a set of XSLT templates for commonly used functions. These are implemented purely in XSLT, that is they do not use any extensions. xsltsl is a SourceForge project.
- xslt.js – Transform XML with XSLT JavaScript library that transforms XML with XSLT in the browser.
|