XSLT

From Seo Wiki - Search Engine Optimization and Programming Languages

Jump to: navigation, search
XSLT
File:XSLT.svg
Filename extension .xsl, .xslt
Internet media type application/xslt+xml[1]
Developed by World Wide Web Consortium
Type of format Stylesheet language
Extended from XML
Standard(s) 1.0 (Recommendation),
2.0 (Recommendation)

Template:Infobox W3C Standard XSLT (XSL Transformations) is a declarative, XML-based language used for the transformation of XML documents into other 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 often used to convert XML data into HTML or XHTML documents for display as a web page: the transformation may happen dynamically either on the client or on the server, or it may be done as part of the publishing process. It is also used to create output for printing or direct video display, typically by transforming the original XML into XSL Formatting Objects to create formatted output which can then be converted to a variety of formats, a few of which are PDF, PostScript, AWT and PNG. XSLT is also used to translate XML messages between different XML schemas, or to make changes to documents within the scope of a single schema, for example by removing the parts of a message that are not needed.

Contents

Origins

XSLT is developed by the World Wide Web Consortium (W3C). The most recent version is XSLT 2.0[4], which reached W3C recommendation status on 23 January 2007. As of 2008, however, XSLT 1.0[5] is still more widely used and implemented.

Originally, XSLT was part of the W3C's Extensible Stylesheet Language (XSL) development effort of 1998–1999, a project that also produced XSL Formatting Objects and the XML Path Language, XPath. The editor of the first version 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[6], the XSL working group joined forces with the XQuery working group to create XPath 2.0[7], with a 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.

As a language, XSLT is influenced by functional languages,[8] and by text-based pattern matching languages like SNOBOL and awk. Its most direct predecessor was ISO DSSSL, a language that performed the same function for full SGML that XSLT performs for XML[9]. Many of the standards committee that developed XSLT had previously worked on DSSSL, including James Clark. XSLT can also be considered Turing-complete[10][11][12][13] template processor.

Most of this article is applicable to both XSLT versions; any differences are noted in the text.

Overview

File:XSLT en.svg
Diagram of the basic elements and process flow of Extensible Stylesheet Language Transformations.

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.

The XSLT processor ordinarily takes two input documents[14]—an XML source document, and an XSLT stylesheet—and produces an output document. The XSLT stylesheet contains a collection of template rules: instructions and other directives that guide the processor in 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 that directly represent their evaluated form: the result tree, which is the basis of the processor's output.

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.

XSLT uses the halfway-to-even ("banker's") method when rounding fractional numbers to integers.

Processor implementations

Template:Main article 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 6.x since 2001 (W3C draft in Internet Explorer 5.x since 1999, or even earlier, but in a form that was incompatible with the final W3C specifications) and in Netscape 7.x since 2002 (partially in Netscape 6.x since 2000)[15], 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 remains limited. See the Comparison of layout engines (XML)#XSL technologies.

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 1.0 processor. Earlier versions may be upgraded and there are many alternatives. See the external links section. Another example is GNOME desktop environment 2.x which includes libxslt, an open source and complete implementation of the XSLT 1.0 specification.[16][17] The libxslt library is also used in other software, such as WebKit layout engine.[18] One of the open source XSLT 1.0 processors is also The Apache Xalan Project.[19]

Performance

Personal tools

Served in 0.819 secs.