Extensibility

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 Writing Extension Functions.

Saxon recognizes the XQuery pragma syntax, but it currently defines only one pragma of its own, the 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.

A function may be marked as a memo function either by using the function annotation %saxon:memo-function or by preceding the function declaration with the option declaration declare option saxon:memo-function.

Saxon recognizes the XQuery option declaration syntax. Several specific option declarations are provided, but most of these are obsolete:

Any other option declaration in the Saxon namespace is ignored with a warning; an option declaration in any other namespace is ignored silently.