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 Reflexive extension functions.
Extensions
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:
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. (See Thesaxon:output
option declaration.)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
. (See Thesaxon:memo-function
option declaration.)
Any other option declaration in the Saxon namespace is ignored with a warning; an option declaration in any other namespace is ignored silently.