SUPPORT THE WORK

GetWiki

XSLT

ARTICLE SUBJECTS
aesthetics  →
being  →
complexity  →
database  →
enterprise  →
ethics  →
fiction  →
history  →
internet  →
knowledge  →
language  →
licensing  →
linux  →
logic  →
method  →
news  →
perception  →
philosophy  →
policy  →
purpose  →
religion  →
science  →
sociology  →
software  →
truth  →
unix  →
wiki  →
ARTICLE TYPES
essay  →
feed  →
help  →
system  →
wiki  →
ARTICLE ORIGINS
critical  →
discussion  →
forked  →
imported  →
original  →
XSLT
[ temporary import ]
please note:
- the content below is remote from Wikipedia
- it has been imported raw for GetWiki
{{short description|Language for transforming XML documents}}







factoids
| latest preview date = | typing = libxslt, Saxon XSLT>Saxon, Xalan| influenced by = DSSSL| influenced = | programming language = | platform = | operating system = | license = www.w3.org/TR/xslt-30/}}| wikibooks = }}







factoids
XSLT (Extensible Stylesheet Language Transformations) is a language originally designed for transforming XML documents into other XML documents,WEB,www.w3.org/standards/xml/transformation, Transformation, 2012-09-19, or other formats such as HTML for web pages, plain text or XSL Formatting Objects, which may subsequently be converted to other formats, such as PDF, PostScript and PNG.WEB,www.w3.org/TR/xslt#output, XML Output Method, 2012-09-19, Support for JSON and plain-text transformation was added in later updates to the XSLT 1.0 specification.{{As of|August 2022}}, the most recent stable version of the language is XSLT 3.0, which achieved Recommendation status in June 2017.XSLT 3.0 implementations support Java, .NET, C/C++, Python, PHP and NodeJS. An XSLT 3.0 Javascript library can also be hosted within the Web Browser. Modern web browsers also include native support for XSLT 1.0.WEB,www.w3.org/standards/xml/transformation#uses, What is XSLT Used For?, 2018-02-07, For an XSLT document transformation, the original document is not changed; rather, a new document is created based on the content of an existing one.WEB,www.w3.org/TR/xslt#section-Introduction, Introduction, W3C, XSL Transformations (XSLT) Version 1.0 W3C Recommendation, 16 November 1999, November 7, 2012, Typically, input documents are XML files, but anything from which the processor can build an XQuery and XPath Data Model can be used, such as relational database tables or geographical information systems.While XSLT was originally designed as a special-purpose language for XML transformation, the language is Turing-complete, making it theoretically capable of arbitrary computations.XSLT Version 2.0 Is Turing-Complete: A Purely Transformation Based Proof

History

XSLT is influenced by functional languages,WEB,www.ibm.com/developerworks/library/x-xslt/, Michael Kay, What kind of language is XSLT?, IBM, July 8, 2016, and by text-based pattern matching languages like SNOBOL and AWK. Its most direct predecessor is DSSSL, which did for SGML what XSLT does for XML.WEB,www.w3.org/TR/NOTE-XSL.html, A Proposal for XSL, W3C, November 7, 2012,
  • XSLT 3.0: became a W3C Recommendation on 8 June 2017. The main new features are:WEB, What’s New in XSLT 3.0?
publisher=w3, 6 January 2014,
    • Streaming transformations: in previous versions the entire input document had to be read into memory before it could be processed,
WEB, Kay, Michael, A Streaming XSLT Processor,www.balisage.net/Proceedings/vol5/html/Kay01/BalisageVol5-Kay01.html, Balisage: The Markup Conference 2010 Proceedings, 15 February 2012, and output could not be written until processing had finished. XSLT 3.0 allows XML streaming which is useful for processing documents too large to fit in memory or when transformations are chained in XML Pipelines.
    • Packages, to improve the modularity of large stylesheets.
    • Improved handling of dynamic errors with, for example, an xsl:try instruction.
    • Support for maps and arrays, enabling XSLT to handle JSON as well as XML.
    • Functions can now be arguments to other (higher-order) functions.

Design and processing model

right|thumb|Diagram of the basic elements and process flow of eXtensible Stylesheet Language Transformations.The XSLT processor takes one or more XML source documents, plus one or more XSLT stylesheets, and processes them to produce one or multiple output documents.{{Citation |last1=Flatt |first1=Amelie |title=Phase III: Generating Artifacts from the Model |date=2022 |url=https://link.springer.com/10.1007/978-3-031-14132-4_5 |work=Model-Driven Development of Akoma Ntoso Application Profiles |pages=31–37 |place=Cham |publisher=Springer International Publishing |language=en |doi=10.1007/978-3-031-14132-4_5 |isbn=978-3-031-14131-7 |access-date=2023-01-07 |last2=Langner |first2=Arne |last3=Leps |first3=Olof}}WEB, XSL Transformations (XSLT) Version 2.0 (Second Edition),www.w3.org/TR/xslt20/#creating-result-trees, 2023-02-07, www.w3.org, Example: Multiple Result Documents, In contrast to widely implemented imperative programming languages like C, XSLT is declarative.WEB, Discover the Wonders of XSLT: XSLT Quirks,www.developer.com/xml/article.php/3357231#Coding%20styles, XSLT is a very specialized language with a distinct declarative flavor., 2011-02-11, 2011-07-09,www.developer.com/xml/article.php/3357231#Coding%20styles," title="web.archive.org/web/20110709015528www.developer.com/xml/article.php/3357231#Coding%20styles,">web.archive.org/web/20110709015528www.developer.com/xml/article.php/3357231#Coding%20styles, dead, The basic processing paradigm is pattern matching.WEB, Kay, Michael, What kind of language is XSLT?,www.ibm.com/developerworks/library/x-xslt/, IBM, 13 November 2013, 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.A typical processor behaves as follows. First, assuming a stylesheet has already been read and prepared, the processor builds a source tree from the input XML document. It then processes the source tree’s root node, finds the best-matching template for that node in the stylesheet, and evaluates the template’s contents. Instructions in each template generally direct the processor to either create nodes in the result tree, or to process more nodes in the source tree in the same way as the root node. Finally the result tree is serialized as XML or HTML text.

XPath

{{details|XPath}}XSLT uses XPath to identify subsets of the source document tree and perform calculations. XPath also provides a range of functions, which XSLT itself further augments.XSLT 1.0 uses XPath 1.0, while XSLT 2.0 uses XPath 2.0. XSLT 3.0 will work with either XPath 3.0 or 3.1. In the case of 1.0 and 2.0, the XSLT and XPath specifications were published on the same date. With 3.0, however, they were no longer synchronized; XPath 3.0 became a Recommendation in April 2014, followed by XPath 3.1 in February 2017; XSLT 3.0 followed in June 2017.

XQuery compared

{{details|XQuery#XQuery and XSLT compared}}XSLT functionalities overlap with those of XQuery, which was initially conceived as a query language for large collections of XML documents.The XSLT 2.0 and XQuery 1.0 standards were developed by separate working groups within W3C, working together to ensure a common approach where appropriate. They share the same data model, type system, and function library, and both include XPath 2.0 as a sublanguage.The two languages, however, are rooted in different traditions and serve the needs of different communities. XSLT was primarily conceived as a stylesheet language whose primary goal was to render XML for the human reader on screen, on the web (as a web template language), or on paper. XQuery was primarily conceived as a database query language in the tradition of SQL.Because the two languages originate in different communities, XSLT is stronger in its handlingof narrative documents with more flexible structure, while XQuery is stronger in its data handling, for example when performing relational joins.WEB, Saxonica: XSLT and XQuery,www.saxonica.com/technology/xslt-and-xquery.xml, 2022-06-29, www.saxonica.com,

Media types

The element can optionally take the attribute media-type, which allows one to set the media type (or MIME type) for the resulting output, for example: . The XSLT 1.0 recommendation recommends the more general attribute types text/xml and application/xml since for a long time there was no registered media type for XSLT. During this time text/xsl became the de facto standard. In XSLT 1.0 it was not specified how the media-type values should be used.With the release of the XSLT 2.0, the W3C recommended in 2007 the registration of the MIME media type application/xslt+xmlWEB, XSL Transformations (XSLT) Version 2.0,www.w3.org/TR/2007/REC-xslt20-20070123/#media-type-registration, W3C, 19 October 2012, and it was later registered with the Internet Assigned Numbers Authority.WEB, Application Media Types,www.iana.org/assignments/media-types/application/index.html, IANA, 19 October 2012, Pre-1.0 working drafts of XSLT used text/xsl in their embedding examples, and this type was implemented and continued to be promoted by Microsoft in Internet ExplorerWEB, XSLT Requirements for Viewing XML in a Browser,msdn.microsoft.com/en-us/library/windows/desktop/ms757857(v=vs.85).aspx, Microsoft, 19 October 2012, and MSXML circa 2012. It is also widely recognized in the xml-stylesheet processing instruction by other browsers. In practice, therefore, users wanting to control transformation in the browser using this processing instruction were obliged to use this unregistered media type.BOOK, Kay, Michael, XSLT 2.0 and XPath 2.0 Programmer’s Reference,archive.org/details/xsltxpathprogram00kaym_646, limited, 2008, Wiley, 978-0-470-19274-0, 100,

Examples

These examples use the following incoming XML document

John
Smith


Morka
Ismincius

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:
John
Morka

Example 2 (transforming XML to XHTML)

Processing the following example XSLT file




Testing XML Example

Persons











,

with the XML input file shown above results in the following XHTML (whitespace has been adjusted here for clarity):
Testing XML Example

Persons

Ismincius, Morka
Smith, John

This XHTML generates the output below when rendered in a web browser.
missing image!
- xslt ex2.png -
center|Rendered XHTML generated from an XML input file and an XSLT transformation.
In order for a web browser to be able to apply an XSL transformation to an XML document on display, an XML stylesheet processing instruction can be inserted into XML. So, for example, if the stylesheet in Example 2 above were available as “example2.xsl”, the following instruction could be added to the original incoming XML:WEB,www.w3.org/TR/xslt#section-Embedding-Stylesheets, XSL Transformations (XSLT) Version 1.0: W3C Recommendation â€“ Embedding Stylesheets, 16 November 1999, W3C, 20 September 2016, In this example, text/xsl is technically incorrect according to the W3C specifications (which say the type should be application/xslt+xml), but it is the only media type that is widely supported across browsers as of 2009, and the situation is unchanged in 2021.

Processor implementations

Performance

Most early XSLT processors were interpreters. More recently, 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 - Article describing implementation & optimization details of a popular XSLT processor. This separation is reflected in the design of XSLT processing APIs (such as JAXP).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 optimization techniques found in functional programming languages and database query languages, such as static rewriting of an expression tree (e.g., to move calculations out of loops), and lazy pipelined evaluation to reduce the memory footprint of 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 significantly more efficient (in both space and time)JOURNAL, Improving Pattern Matching Performance in XSLT, John, Lumley, Michael, Kay, June 2015, XML London 2015, 10.14337/XMLLondon15.Lumley01,xmllondon.com/2015/presentations/lumley, 9–25, 2024-02-27, 978-0-9926471-2-4, free, than general-purpose DOM implementations.In June 2014, Debbie Lockett and Michael Kay introduced an open-source benchmarking framework for XSLT processors called XT-Speedo.JOURNAL, Benchmarking XSLT Performance, Michael, Kay, Debbie, Lockett, June 2014, XML London 2014, 10.14337/XMLLondon14.Kay01,xmllondon.com/2014/presentations/kay, 10–23, 2024-02-27, 978-0-9926471-1-7, free,

See also

References

{{Reflist|30em}}

Further reading

  • 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 and XPath 2.0 Programmer’s Reference by Michael Kay ({{ISBN|978-0-470-19274-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}})
  • XSL-FO by Dave Pawson, published by O’Reilly ({{ISBN|978-0-596-00355-5}})

External links

{{Commons category|Extensible Stylesheet Language Transformations}}
Documentation


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.
  • Kernow A GUI for Saxon that provides a point and click interface for running transforms.
  • xslt.js â€“ Transform XML with XSLT JavaScript library that transforms XML with XSLT in the browser.
{{XSL}}{{W3C Standards}}{{Authority control}}

- content above as imported from Wikipedia
- "XSLT" does not exist on GetWiki (yet)
- time: 10:18am EDT - Wed, May 22 2024
[ this remote article is provided by Wikipedia ]
LATEST EDITS [ see all ]
GETWIKI 21 MAY 2024
GETWIKI 09 JUL 2019
Eastern Philosophy
History of Philosophy
GETWIKI 09 MAY 2016
GETWIKI 18 OCT 2015
M.R.M. Parrott
Biographies
GETWIKI 20 AUG 2014
CONNECT