Appendix A. Extension Functions for XPath in XSLT

While XPath includes a powerful set of basic functions, some applications of XPath need to support capabilities that go beyond that core. Currently, the most widely used XPath-based application is, of course, XSLT; aside from proprietary extensions offered through the various XSLT processors, it acquires these extra capabilities by way of two commonly used sets of extension functions. (Don’t count on their availability in other XPath-based contexts, although because of their usefulness they may be adopted elsewhere as well.)

The first set of functions comes from XSLT itself, providing access to path, node, and string-value handling facilities necessary for XSLT processing. The second set of functions comes from the independent Extensions to XSLT (EXSLT) project, providing support for a variety of tasks that weren’t addressed in either XPath 1.0 or XSLT 1.0.

Additional Functions in XSLT 1.0

When XPath and XSLT were separated into two specifications, it was clear that there were some functions that relied on information available only through an understanding of the current XSLT processing context. These functions were kept in XSLT rather than in XPath, and (to repeat) may or may not be available in XPath processing in other contexts. You will see these functions used frequently in XSLT processing. Table A-1 lists the additional functions provided by XSLT 1.0.

Table A-1. Additional functions provided by XSLT 1.0

Function prototype ...

Get XPath and XPointer now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.