Using Extension Functions from the EXSLT Library
Earlier we mentioned the EXSLT project, an effort to define a common set of XSLT extension functions. For our next example, we’ll use functions from the EXSLT library. Both Saxon and Xalan have EXSLT support built in, so it’s very easy to use extensions from the EXSLT library.
Note
Although a number of XSLT processors support EXSLT, be aware that EXSLT is implemented inconsistently between processors. Not all processors support all functions, and not all functions have the same signature or results.
EXSLT provides eight categories of functions:
- Common
Common functions for data typing and for working with node-sets. These are in the
http://exslt.org/commonnamespace.- Dates and times
Functions for manipulating dates and times. These are in the
http://exslt.org/dates-and-timesnamespace.- Dynamic
Functions to dynamically evaluate XPath expressions. These are in the
http://exslt.org/dynamicnamespace.- Functions
Extension elements and functions that allow you to define your own functions. These are in the
http://exslt.org/functionsnamespace.- Math
Functions for trigonometry, exponentiation, logarithms, and other miscellaneous mathematical functions. These are in the
http://exslt.org/mathnamespace.- Random
A single function (
random-sequence()) that generates a sequence of random values between0and1. It is in thehttp://exslt.org/randomnamespace.- Regular expressions
Functions that work with regular expressions. These are in the
http://exslt.org/regular-expressions ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access