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.
There are a number of XQuery specific extensions available, which are fully documented in Extensions:
-
Saxon recognizes the XQuery pragma syntax, but it currently defines only one pragma of its own, the
saxon:validate-type
pragma, and this is now mostly redundant since the equivalent facility is standard in XQuery 3.0. It serves one remaining purpose, which is to allow attributes to be validated. 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 recognizes the XQuery option declaration syntax. Some specific option declarations are provided, but these are mostly obsolete:
-
declare option saxon:output
declares a serialization parameter. Superseded bydeclare option output:XXXXX
; except Saxon-specific option declarations are still needed for declaring Saxon-specific serialization parameters. -
declare option saxon:memo-function
defines whether the following function declaration is to be implemented as a memo function; superseded by the function annotation%saxon:memo-function
.
Any other option declaration in the Saxon namespace is ignored with a warning; an option declaration in any other namespace is ignored silently.
-