<?xml version="1.0" encoding="iso-8859-1"?> <?xml-stylesheet href="../make-menu.xsl" type="text/xsl"?><html> <head> <this-is section="using-xquery" page="extensibility" subpage=""/> <!-- Generated at 2011-12-09T20:47:22.916Z--><title>Saxonica: XSLT and XQuery Processing: Extensibility</title> <meta name="coverage" content="Worldwide"/> <meta name="copyright" content="Copyright Saxonica Ltd"/> <meta name="title" content="Saxonica: XSLT and XQuery Processing: Extensibility"/> <meta name="robots" content="noindex,nofollow"/> <link rel="stylesheet" href="../saxondocs.css" type="text/css"/> </head> <body class="main"> <h1>Extensibility</h1> <p>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 <code>declare namespace math="java:java.lang.Math"</code>, and invoke the method as <code>math:sqrt(2)</code>.</p> <p>More details of this mechanism are found in <a class="bodylink" href="../extensibility/functions.xml">Writing Extension Functions</a>.</p> <p>Saxon recognizes the XQuery pragma syntax, but it currently defines only one pragma of its own, the <code>saxon:validate-type</code> pragma (see <a class="bodylink" href="../using-xquery/extensions.xml">Extensions</a>), 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.</p> <p>Saxon also recognizes the XQuery option declaration syntax. Several specific option declarations are provided: <code>declare option saxon:default</code> declares a default value for external variables (query parameters); <code>declare option saxon:output</code> declares a serialization parameter; and <code>declare option saxon:memo-function</code> defines whether the following function declaration is to be implemented as a memo function. These are described under <a class="bodylink" href="../using-xquery/extensions.xml">Extensions</a>. Any other option declaration in the Saxon namespace is ignored with a warning; an option declaration in any other namespace is ignored silently.</p> <table width="100%"> <tr> <td> <p align="right"><a class="nav" href="extensions.xml">Next</a></p> </td> </tr> </table> </body> </html>