Information AboutXslt |
| CATEGORIES ABOUT XSL TRANSFORMATIONS | |
| w3c standards | |
| xml-based standards | |
| xml-based programming languages | |
| markup languages | |
| declarative programming languages | |
| functional languages | |
| domain-specific programming languages | |
Extensible Stylesheet Language Transformations (XSLT) is an s or to convert XML data into HTML or XHTML documents for Web Page s, creating a Dynamic Web Page , or into an intermediate XML format that can be converted to PDF documents. As a Language , XSLT is influenced by Functional Languages ,1 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 . XSLT is Turing Complete .Kepser, Stephan. (2004). A Simple Proof for the Turing-Completeness of XSLT and XQuery ''. International Digital Enterprise Alliance.http://www.unidex.com/turing/utm.htmhttp://www.refal.net/~korlukov/tm/ 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 .) 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. Most of this article is applicable to both XSLT versions; any differences are noted in the text. OVERVIEW The XSLT processing model involves:
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 filesIn this context, "document" and "file" refers to a file, a string, or any other recognizable input stream, not just a fixed file. – 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 Expression s which 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. 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. 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 MSXML 3 library, which includes an XSLT processor. Earlier versions may be upgraded and there are many alternatives, see the '' External Links '' section. 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. Saxon: Anatomy of an XSLT processor - An article describing the implementation and optimization details of a popular Java-based XSLT processor. This separation is reflected in the design of XSLT processing APIs such as JAXP ( Java API For XML Processing ).
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. 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 Example 1 (transforming XML to XML) This XSLT stylesheet provides templates to transform the XML document: Its evaluation results in a new XML document, having another structure: Example 2 (transforming XML to XHTML) Example XSLT Stylesheet: PersonsXHTML output that this would produce ( Whitespace has been adjusted here for clarity): REFERENCES SEE ALSO
EXTERNAL LINKS ; For implementations, see XML Template Engine . ; Documentation
; Mailing lists ; Books
; XSLT code libraries
|
|
|