Saxonica.com

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; note however that for XQuery the only form of namespace URI accepted is java:full.class.Name.

Saxon recognizes the XQuery pragma syntax, but it does not currently define any pragmas of its own. This means that 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. Two specific option declarations are provided: declare option saxon:default declares a default value for external variables (query parameters), and declare option saxon:output declares a serialization parameter. 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.

Next