Extensible Stylesheet Language

From Wikipedia, the free encyclopedia

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. The syntax of XSL language itself is valid XML and uses constructs such as:

<xsl:if test="@author='Jones'">Hello Mrs. Jones!</xsl:if>

The begin-tag and end-tag of every statement is syntactically similar to the opening and closing parenthesis of Lisp. XSL is designed to be data driven and strongly encourages the inversion of control design pattern. The language assumes you are processing an XML file as a tree to produce a text-based output document, generally HTML, XML, plain-text, or PDF. Variables can be declared, but their values cannot be changed. Several data-driven looping constructs are provided, but arbitrary loops can still be constructed without altering any variables by using recursion (like Scheme).

There are three languages in the family:

  • XSL Transformations (XSLT): an XML language for transforming XML documents
  • XSL Formatting Objects (XSL-FO): an XML language for specifying the visual formatting of an XML document
  • the XML Path Language (XPath): a non-XML language used by XSLT, and also available for use in non-XSLT contexts, for addressing the parts of an XML document.

These three specifications are available in the form of W3C Recommendations.

Early Working Drafts that preceded the XSLT Recommendation didn't have the "T" at the end of XSLT; the term XSL was used instead, and the language included rudiments of what later became XPath.

Contents

[edit] 'XSL' in Microsoft products

Microsoft's MSXML, first released in March 1999, contained an incomplete implementation of the December 1998 Working Draft of XSL. Since the mid-2000 release of MSXML 3.0, MSXML has had complete support for both XSLT 1.0 and the older dialect. MSXML 3.0 became Internet Explorer's default XML services library upon the release of IE 6.0 in August 2001. Older versions of IE could use MSXML 3.0 only if it was custom-installed in "replace mode".

The term XSL is sometimes used to refer to the dialect described in the Working Draft and as implemented in MSXML, including MSXML-specific extensions and omissions. Other commentators generally refer to it as WD-xsl.

[edit] History

XSL began as an attempt to bring the functionality of DSSSL, particularly in the area of print and high-end typesetting, to XML. A W3C Working group on XSL was started in December 1997, with Sharon Adler and Steve Zilles as co-chairs, with James Clark acting as editor (and unofficially as chief designer), and Chris Lilley as W3C staff contact. The group released a first public Working Draft on 18 August 1998. XSLT and XPath became W3C Recommendations on 16 November 1999 and XSL-FO reached Recommendation status on 15 October 2001.

[edit] The XSL family

[edit] XSL Transformations

Main article: XSL Transformations

There are currently many XSLT implementations available. Several Web browsers, including Internet Explorer (using the MSXML engine), Firefox, Mozilla, and Netscape (all using the TransforMiiX engine), and Opera (native engine), all support transformation of XML to HTML through XSLT. Other notable implementations are Saxon and Xalan.

[edit] XSL Formatting Objects

XSL Formatting Objects support is becoming more widespread as of late. The XEP package from RenderX has near 100% support for XSL-FO 1.0. XSLFormatter from Antenna House also has near 100% support for the XSL-FO 1.0 specification and has 100% support for all new features within the XSL-FO 1.1 specification. XINC from Lunasil has a great amount of support for the XSL-FO 1.0 specification. FOP from the Apache project, can render a portion of the XSL formatting objects 1.0 specification to PDF.

Other file formats are supported to various degrees:

[edit] XPath

Main article: XPath

XML Path Language (XPath) is used by XSLT as a means of navigating an XML document and is part of the XSL family.

XQuery is another W3C project which is intended to provide similar capabilities for querying XML documents using XPath.

[edit] See also

[edit] External links