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/common namespace.

Dates and times

Functions for manipulating dates and times. These are in the http://exslt.org/dates-and-times namespace.

Dynamic

Functions to dynamically evaluate XPath expressions. These are in the http://exslt.org/dynamic namespace.

Functions

Extension elements and functions that allow you to define your own functions. These are in the http://exslt.org/functions namespace.

Math

Functions for trigonometry, exponentiation, logarithms, and other miscellaneous mathematical functions. These are in the http://exslt.org/math namespace.

Random

A single function (random-sequence()) that generates a sequence of random values between 0 and 1. It is in the http://exslt.org/random namespace.

Regular expressions

Functions that work with regular expressions. These are in the http://exslt.org/regular-expressions ...

Get XSLT, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.