Extension Functions
As you might guess, an extension function is defined in a piece of code accessed from the XSLT stylesheet. In some cases, that function is written in a scripting language in the stylesheet itself. In those instances, the scripting code is contained in an XML element that is not in the XSLT namespace. In other cases, the function is in a separate file that is loaded by the XSLT processor at runtime. The code for the function might be written in a scripting language or it might be written in a compiled language.
Regardless of how the extension function is written or accessed, you can pass values to the function and the function can return a result. That result can be any of the datatypes supported by XPath. In addition, XSLT processors are free to allow extension functions to return other datatypes, although those other datatypes must be handled by some other function that does return one of XPath’s datatypes.
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