Chapter 15. Extensions

Extensibility defines the ways in which a language can be extended. XSLT is extensible, meaning that if you are a programmer, you can add your own functionality to a processor in the form of extension elements, attributes, and functions. The developers of XSLT realized that they couldn't please everyone with their first shot (who can?), so they made it possible for developers to both add features to their XSLT processors independently, and to share those features with others.

If you aren't going to write your own extensions, you still have a lot of extensions available to you through other processors. Most processors offer their own internal extensions, such as Xalan and Saxon. The EXSLT group also provides a number of extensions that can be supported directly by a processor or by pure XSLT 1.0 processors (see http://www.exslt.org). EXSLT organizes its extensions into modules, such as math and string modules. You can submit extension implementations and proposals to EXSLT; Xalan and Saxon also provide means to add your own external extensions and then integrate them in with the existing processor.

The EXSLT effort attempts to standardize and unify all XSLT 1.0 extensions. Saxon, for example, now implements many, but not all, EXSLT extension functions. It is good practice to use EXSLT extensions when available, if your processor supports them. It may be easier, however, to simply use a proprietary extension offered by your processor. XSLT 2.0 and XPath 2.0, discussed in the next chapter, offer many more functions than their predecessors, and will likely be the most successful at unifying previous extensions to XSLT 1.0 and XPath 1.0.

In this chapter, I'll provide a sample of available extensions and, to get you started, show you how to use some of them. This will include how to use the extension-element-prefixes attribute on the stylesheet element. I'll also show you how to test for extension availability and provide for fallback behavior using the fallback and message elements. In the first part of the chapter, I'll list extension functionality offered by three sources: Xalan, Saxon, and EXSLT.



Learning XSLT
Learning XSLT
ISBN: 0596003277
EAN: 2147483647
Year: 2003
Pages: 164

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