XSLT Extensibility

XSLT Extensibility

Despite the apparent complexity of XSLT, its limited in many ways compared to programming languages, and one of the first things that XSLT processors did was to start introducing extensions to XSLT. For example, Saxon introduced the <saxon:while> element that implements a programming-style while loop in XSLT. Xalan introduced elements such as <redirect:write> to support multiple output documents. And Microsofts MSXML3 processor enables you to write functions in scripting languages such as JavaScript and then call them to execute the code in them.

One can imagine W3C viewing this trend with trepidation. Their job, after all, is to standardize how languages such as XSLT work, but manufacturers were introducing their own, non-standard extensions in the form of new elements and functions all the time. On the other hand, W3C couldnt anticipate all new elements and functions, so instead they started working on standardizing ways of connecting extension functions and elements to XSLT. Extensions must use some general rules:

  • Extensions must use namespaces to avoid clashes with XSL elements.

  • It must be possible for an XSLT processor to realize where an extension has been used, and fail in a well-defined way if the extension fails.

  • It must be possible for a stylesheet to test whether a certain extension is available and fall back if not.

Upcoming in XSLT 2.0

Its easy to imagine W3C chafing even under these general rules, and in fact, one of the possibilities that the XSLT 2.0 committee is going to investigate is whether to implement all extensions in pure XSLT, without resorting to any external programming languages at all.

The W3C has allowed two kinds of extensions, mostly because they were already de facto : extension functions and extension elements. Although they are popular, this is a somewhat gray area, because different manufacturers have introduced different ways of implementing these kinds of extensions.

In XSLT 1.0, you can test whether an extension function is available with the function-available function, and you can test whether an extension element is available with the element-available function.

XSLT 2.0 is going to define a standard mechanism for connecting XSLT to extension elements, and it presumably will be much more elaborate than whats available now.

Its time to see all this in action. Im going to take a look at both extension functions and extension elements in the following sections, starting with extension functions.

The EXSLT Initiative

Now that the extension mechanisms in the XSLT 1.1 working draft have been deferred to XSLT 2.0, various other efforts to standardize XSLT extensions have become more important. For example, take a look at EXSLT at www.exslt.org. EXSLT is an open community initiative working to standardize extensions to XSLT.



Inside XSLT
Inside Xslt
ISBN: B0031W8M4K
EAN: N/A
Year: 2005
Pages: 196

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net