Most XSLT 1.0 processors, particularly the ones written in Java, let
you write extension functions in the processor’s host language, link
them in, and then call those functions from stylesheets. The XSLT 1.0
specification spells out specific ways to check whether a particular
extension function is available and how to recover gracefully if not.
In the September 2001 “Transforming XML” column, the author presented
examples of extension elements and functions. If you want to write
your own functions within a stylesheet, there were ways to fake it
with named templates, but faking it won’t be necessary with XSLT 2.0,
which lets you write your own functions using XSLT syntax. These
functions return values that can be used all over your spreadsheet,
even in XPath expressions.
Bob DuCharme, XML.com