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
More details of this mechanism are found in Writing Extension Functions.
Saxon recognizes the XQuery pragma syntax, but it currently defines only one pragma of its own,
saxon:validate-type pragma (see Extensions),
and this is now redundant since the equivalent facility is standard in XQuery 3.0.
Saxon will adopt the correct fallback behavior if presented with a query that uses another
vendor's extensions, provided these are designed in conformance with the W3C pragma specification.
Saxon also recognizes the XQuery option declaration syntax. Several specific option declarations are
declare option saxon:default declares a default value for external variables
declare option saxon:output declares a serialization parameter;
declare option saxon:memo-function defines whether the following function declaration is
to be implemented as a memo function.
These are described under Extensions. Any other option declaration in the
Saxon namespace is ignored with a warning; an option declaration in any other namespace is ignored silently.