The Saxon XQuery implementation allows you to call Java methods as external functions. The function does not need to be declared. Use a namespace declaration such as declare namespace math="java:java.lang.Math", and invoke the method as math:sqrt(2).

More details of this mechanism are found in Reflexive extension functions.


Saxon provides many extensions and implementation-defined features which can be used in XQuery. See Extensions for full details about using these.

The full library of Saxon, EXSLT and EXPath functions described in the Function library is available, except for those (for example, some forms of saxon:serialize) that have an intrinsic dependency on an XSLT stylesheet.

The XPath syntax extensions described in Experimental 4.0 extensions are also available in XQuery.

There are a number of XQuery specific extensions available, which are fully documented in XQuery syntax extensions: