# EXSLT Extensions

EXSLT is an initiative to define a standardized set of extension functions and extension elements that can be used across different XSLT processors.

Saxon supports the EXSLT modules Common, Math, Sets, DatesAndTimes, and Random. These functions are available both in XSLT and in XQuery. The full list of EXSLT extension functions implemented is:

- common (namespace http://exslt.org/common): node-set(), object-type()

- math (namespace http://exslt.org/math): abs(), acos(), asin(), atan(), atan2(), constant(), cos(), exp(), highest(), log(), lowest(), max(), min(), power(), random(), sin(), sqrt(), tan(). The random() function is also implemented, but it doesnt' work well: since it is not a pure function, Saxon sometimes optimizes it so that successive calls all return the same value. The random:random-sequence() function is preferable.

- sets (namespace http://exslt.org/sets): difference(), intersection(), leading(), trailing(), has-same-node()

- dates-and-times (namespace http://exslt.org/dates-and-times): date-time(), date(), time(), year(), leap-year(), month-in-year(), month-name(), month-abbreviation(), week-in-year(), week-in-month(), day-in-year(), day-in-month(), day-of-week-in-month(), day-in-week(), day-abbreviation(), hour-in-day(), minute-in-hour(), second-in-minute().

- random (namespace http://exslt.org/random): random-sequence()

These have considerable overlap with extension function and elements that have previously been provided in the Saxon namespace. In some cases the Saxon versions of the functions remain available, for the time being, but the EXSLT versions are preferred.

There are some known restrictions:

- In the `set:leading()` and `set:trailing()` functions, Saxon does not implement the rule "If the first node in the second node set is not contained in the first node set, then an empty node set is returned." This rule prevents a pipelined implementation. Saxon returns all nodes that precede/follow the first/last node of the second node-set in document order, whether or not the two node-sets intersect.

EXSLT extensions that overlap XSLT 2.0 functionality have sometimes been retained in cases where they have no impact on the Saxon core code, but in cases (such as `func:function`) where the semantics are inconveniently different from XSLT 2.0, they have been withdrawn.

Expand | Next