<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>ExtensionFunctionDefinition</title> <meta name="keywords" content="Saxon.Api.ExtensionFunctionDefinition class"> <link rel="stylesheet" type="text/css" href="../../stylesheet.css" title="Style"> </head> <body> <div style="width:20%; float:left; background-color:#c1cede; overflow:auto; height:100%"> <h2>Saxon.Api</h2> <div style="position:relative; height:4pt"> <p>Class <a href="DocumentBuilder.html">DocumentBuilder</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="DomDestination.html">DomDestination</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="DynamicContext.html">DynamicContext</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="DynamicError.html">DynamicError</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="EmptyEnumerator.html">EmptyEnumerator</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="ExtensionFunctionCall.html">ExtensionFunctionCall</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="ExtensionFunctionDefinition.html">ExtensionFunctionDefinition</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="NullDestination.html">NullDestination</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="Processor.html">Processor</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="QName.html">QName</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="SchemaManager.html">SchemaManager</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="SchemaValidator.html">SchemaValidator</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="Serializer.html">Serializer</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="StaticContext.html">StaticContext</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="StaticError.html">StaticError</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="TextWriterDestination.html">TextWriterDestination</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XPathCompiler.html">XPathCompiler</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XPathExecutable.html">XPathExecutable</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XPathSelector.html">XPathSelector</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XQueryCompiler.html">XQueryCompiler</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XQueryEvaluator.html">XQueryEvaluator</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XQueryExecutable.html">XQueryExecutable</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XdmAnyFunctionType.html">XdmAnyFunctionType</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XdmAnyItemType.html">XdmAnyItemType</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XdmAnyNodeType.html">XdmAnyNodeType</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XdmAtomicType.html">XdmAtomicType</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XdmAtomicValue.html">XdmAtomicValue</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XdmDestination.html">XdmDestination</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XdmEmptySequence.html">XdmEmptySequence</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XdmFunctionItem.html">XdmFunctionItem</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XdmItem.html">XdmItem</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XdmItemType.html">XdmItemType</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XdmNode.html">XdmNode</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XdmNodeKind.html">XdmNodeKind</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XdmSequenceType.html">XdmSequenceType</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XdmValue.html">XdmValue</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XmlDestination.html">XmlDestination</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XsltCompiler.html">XsltCompiler</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XsltExecutable.html">XsltExecutable</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XsltTransformer.html">XsltTransformer</a></p> </div> <div style="position:relative; height:4pt"> <p>Enum <a href="RecoveryPolicy.html">RecoveryPolicy</a></p> </div> <div style="position:relative; height:4pt"> <p>Enum <a href="SchemaValidationMode.html">SchemaValidationMode</a></p> </div> <div style="position:relative; height:4pt"> <p>Enum <a href="TreeModel.html">TreeModel</a></p> </div> <div style="position:relative; height:4pt"> <p>Enum <a href="WhitespacePolicy.html">WhitespacePolicy</a></p> </div> <div style="position:relative; height:4pt"> <p>Enum <a href="XdmAxis.html">XdmAxis</a></p> </div> <div style="position:relative; height:4pt"> <p>Interface <a href="IMessageListener.html">IMessageListener</a></p> </div> <div style="position:relative; height:4pt"> <p>Interface <a href="IQueryResolver.html">IQueryResolver</a></p> </div> <div style="position:relative; height:4pt"> <p>Interface <a href="IResultDocumentHandler.html">IResultDocumentHandler</a></p> </div> <div style="position:relative; height:4pt"> <p>Interface <a href="IXdmEnumerator.html">IXdmEnumerator</a></p> </div> <div style="position:relative; height:4pt"> <p>Interface <a href="IXmlLocation.html">IXmlLocation</a></p> </div> <div style="position:relative; height:4pt"> <p>Interface <a href="SchemaResolver.html">SchemaResolver</a></p> </div> </div> <div style="width:5%; float:left; background-color:#e4eef0; overflow:auto; height:100%"> </div> <div style="float:left; width:75%; overflow:auto; height:100%;"> <h2><font size="-1">Saxon.Api</font><br>Class ExtensionFunctionDefinition </h2> <hr> <dl> <dt><pre>public abstract class ExtensionFunctionDefinition</pre></dt> <dt> implements <a href="http://msdn.microsoft.com/en-us/library/system.object(VS.80).aspx">object</a></dt> </dl> <dl> <dd> <p>Abstract superclass for user-written extension functions. An extension function may be implemented as a subclass of this class, with appropriate implementations of the defined methods. </p> <p>More precisely, a subclass of <code>ExtensionFunctionDefinition</code> identifies a family of extension functions with the same (namespace-qualified) name but potentially having different arity (number of arguments). </p> <p>A user-defined extension function is typically implemented using a pair of classes: a class that extends <code>ExtensionFunctionDefinition</code>, whose purpose is to define the properties of the extension function (in particular, its signature -- the types of its arguments and result); and a class that extends <code>ExtensionFunctionCall</code>, whose purpose is to perform the actual evaluation. </p> <p>The <code>ExtensionFunctionDefinition</code> is immutable and will normally have a singleton instance for each subclass; this singleton instance is registered with the <code>Processor</code> to associate the name of the extension function with its definition. </p> <p>The <code>ExtensionFunctionCall</code> has one instance for each call on the extension function appearing in the source code of a stylesheet or query; this instance is created when Saxon calls the method <code>MakeFunctionCall</code> provided by the <code>ExtensionFunctionDefinition</code> object. The instance of <code>ExtensionFunctionCall</code> holds information about the static context of the function call, and its <code>Call</code> method is called (by Saxon) to evaluate the extension function at run-time. </p> </dd> </dl> <hr><a name="property_summary"></a><table border="1" width="100%" cellpadding="3" cellspacing="0" summary=""> <tr border="#ccccff" class="TableHeadingColor"> <th align="left" colspan="2"><font size="+2"><b>Property Summary</b></font></th> </tr> <tr bgcolor="white" class="TableRowColor"> <td align="right" valign="top" width="1%"><code> <a href="QName.html">QName</a></code></td> <td><code><b><a href="#FunctionName">FunctionName</a></b></code><p> Read-only property returning the name of the extension function, as a QName. </p> </td> </tr> <tr bgcolor="white" class="TableRowColor"> <td align="right" valign="top" width="1%"><code> <a href="http://msdn.microsoft.com/en-us/library/system.int32(VS.80).aspx">int</a></code></td> <td><code><b><a href="#MinimumNumberOfArguments">MinimumNumberOfArguments</a></b></code><p> Read-only property giving the minimum number of arguments in a call to this extension function. </p> </td> </tr> <tr bgcolor="white" class="TableRowColor"> <td align="right" valign="top" width="1%"><code> <a href="http://msdn.microsoft.com/en-us/library/system.int32(VS.80).aspx">int</a></code></td> <td><code><b><a href="#MaximumNumberOfArguments">MaximumNumberOfArguments</a></b></code><p> Read-only property giving the maximum number of arguments in a call to this extension function. </p> </td> </tr> <tr bgcolor="white" class="TableRowColor"> <td align="right" valign="top" width="1%"><code> XdmSequenceType[]</code></td> <td><code><b><a href="#ArgumentTypes">ArgumentTypes</a></b></code><p> Read-only property giving the required types of the arguments to this extension function. If the number of items in the array is less than the maximum number of arguments, then the last entry in the returned ArgumentTypes is assumed to apply to all the rest; if the returned array is empty, then all arguments are assumed to be of type <code>item()*</code> </p> </td> </tr> <tr bgcolor="white" class="TableRowColor"> <td align="right" valign="top" width="1%"><code> Boolean</code></td> <td><code><b><a href="#TrustResultType">TrustResultType</a></b></code><p> This property may return true for a subclass if it guarantees that the returned result of the function will always be of the declared return type: setting this to true by-passes the run-time checking of the type of the value, together with code that would otherwise perform atomization, numeric type promotion, and similar conversions. If the value is set to true and the value is not of the correct type, the effect is unpredictable and probably disastrous. </p> </td> </tr> <tr bgcolor="white" class="TableRowColor"> <td align="right" valign="top" width="1%"><code> Boolean</code></td> <td><code><b><a href="#DependsOnFocus">DependsOnFocus</a></b></code><p> This property must return true for a subclass if the evaluation of the function makes use of the context item, position, or size from the dynamic context. It should also return true (despite the property name) if the function makes use of parts of the static context that vary from one part of the query or stylesheet to another. Setting the property to true inhibits certain Saxon optimizations, such as extracting the call from a loop, or moving it into a global variable. </p> </td> </tr> <tr bgcolor="white" class="TableRowColor"> <td align="right" valign="top" width="1%"><code> Boolean</code></td> <td><code><b><a href="#HasSideEffects">HasSideEffects</a></b></code><p> This property should return true for a subclass if the evaluation of the function has side-effects. Saxon never guarantees the result of calling functions with side-effects, but if this property is set, then certain aggressive optimizations will be avoided, making it more likely that the function behaves as expected. </p> </td> </tr> </table> <a name="method_summary"></a><table border="1" width="100%" cellpadding="3" cellspacing="0" summary=""> <tr border="#ccccff" class="TableHeadingColor"> <th align="left" colspan="2"><font size="+2"><b>Method Summary</b></font></th> </tr> <tr bgcolor="white" class="TableRowColor"> <td align="right" valign="top" width="1%"><code> <a href="XdmSequenceType.html">XdmSequenceType</a></code></td> <td><code><b><a href="#ResultType(Saxon.Api.XdmSequenceType[])">ResultType</a></b>(Saxon.Api.XdmSequenceType[] ArgumentTypes)</code><p> Method returning the declared type of the return value from the function. The type of the return value may be known more precisely if the types of the arguments are known (for example, some functions return a value that is the same type as the first argument. The method is therefore called supplying the static types of the actual arguments present in the call. </p> </td> </tr> <tr bgcolor="white" class="TableRowColor"> <td align="right" valign="top" width="1%"><code> <a href="ExtensionFunctionCall.html">ExtensionFunctionCall</a></code></td> <td><code><b><a href="#MakeFunctionCall()">MakeFunctionCall</a></b>()</code><p> Factory method to create an <code>ExtensionFunctionCall</code> object, representing a specific function call in the XSLT or XQuery source code. Saxon will call this method once it has identified that a specific call relates to this extension function. </p> </td> </tr> </table> <a name="property_detail"></a><table border="1" width="100%" cellpadding="3" cellspacing="0" summary=""> <tr border="#ccccff" class="TableHeadingColor"> <th align="left" colspan="2"><font size="+2"><b>Property Detail</b></font></th> </tr> </table><a name="FunctionName"></a><h3>FunctionName</h3><pre>public abstract <a href="QName.html">QName</a> <b>FunctionName</b> {}</pre><dl> <dd> <p> Read-only property returning the name of the extension function, as a QName. </p> <p> A getter for this property must be implemented in every subclass. </p> </dd> </dl> <hr><a name="MinimumNumberOfArguments"></a><h3>MinimumNumberOfArguments</h3><pre>public abstract <a href="http://msdn.microsoft.com/en-us/library/system.int32(VS.80).aspx">int</a> <b>MinimumNumberOfArguments</b> {}</pre><dl> <dd> <p> Read-only property giving the minimum number of arguments in a call to this extension function. </p> <p> A getter for this property must be implemented in every subclass. </p> </dd> </dl> <hr><a name="MaximumNumberOfArguments"></a><h3>MaximumNumberOfArguments</h3><pre>public abstract <a href="http://msdn.microsoft.com/en-us/library/system.int32(VS.80).aspx">int</a> <b>MaximumNumberOfArguments</b> {}</pre><dl> <dd> <p> Read-only property giving the maximum number of arguments in a call to this extension function. </p> <p> A getter for this property must be implemented in every subclass. </p> </dd> </dl> <hr><a name="ArgumentTypes"></a><h3>ArgumentTypes</h3><pre>public abstract XdmSequenceType[] <b>ArgumentTypes</b> {}</pre><dl> <dd> <p> Read-only property giving the required types of the arguments to this extension function. If the number of items in the array is less than the maximum number of arguments, then the last entry in the returned ArgumentTypes is assumed to apply to all the rest; if the returned array is empty, then all arguments are assumed to be of type <code>item()*</code> </p> <p> A getter for this property must be implemented in every subclass. </p> </dd> </dl> <hr><a name="TrustResultType"></a><h3>TrustResultType</h3><pre>public virtual Boolean <b>TrustResultType</b> {}</pre><dl> <dd> <p> This property may return true for a subclass if it guarantees that the returned result of the function will always be of the declared return type: setting this to true by-passes the run-time checking of the type of the value, together with code that would otherwise perform atomization, numeric type promotion, and similar conversions. If the value is set to true and the value is not of the correct type, the effect is unpredictable and probably disastrous. </p> <p> The default value of this property is <code>false</code>. A getter for this property may be implemented in a subclass to return a different value. </p> </dd> </dl> <hr><a name="DependsOnFocus"></a><h3>DependsOnFocus</h3><pre>public virtual Boolean <b>DependsOnFocus</b> {}</pre><dl> <dd> <p> This property must return true for a subclass if the evaluation of the function makes use of the context item, position, or size from the dynamic context. It should also return true (despite the property name) if the function makes use of parts of the static context that vary from one part of the query or stylesheet to another. Setting the property to true inhibits certain Saxon optimizations, such as extracting the call from a loop, or moving it into a global variable. </p> <p> The default value of this property is <code>false</code>. A getter for this property may be implemented in a subclass to return a different value. </p> </dd> </dl> <hr><a name="HasSideEffects"></a><h3>HasSideEffects</h3><pre>public virtual Boolean <b>HasSideEffects</b> {}</pre><dl> <dd> <p> This property should return true for a subclass if the evaluation of the function has side-effects. Saxon never guarantees the result of calling functions with side-effects, but if this property is set, then certain aggressive optimizations will be avoided, making it more likely that the function behaves as expected. </p> <p> The default value of this property is <code>false</code>. A getter for this property may be implemented in a subclass to return a different value. </p> </dd> </dl> <hr><a name="method_detail"></a><table border="1" width="100%" cellpadding="3" cellspacing="0" summary=""> <tr border="#ccccff" class="TableHeadingColor"> <th align="left" colspan="2"><font size="+2"><b>Method Detail</b></font></th> </tr> </table><a name="ResultType(Saxon.Api.XdmSequenceType[])"></a><h3>ResultType</h3><pre>public abstract <a href="XdmSequenceType.html">XdmSequenceType</a> <b>ResultType</b>(Saxon.Api.XdmSequenceType[] ArgumentTypes)</pre><dl> <dd> <p> Method returning the declared type of the return value from the function. The type of the return value may be known more precisely if the types of the arguments are known (for example, some functions return a value that is the same type as the first argument. The method is therefore called supplying the static types of the actual arguments present in the call. </p> <p> This method must be implemented in every subclass. </p><b>Parameters:</b><dl> <dt><code>ArgumentTypes</code> - </dt> <dd> The static types of the arguments present in the function call </dd> </dl> <dl> <dt>returns</dt> <dd> An <code>XdmSequenceType</code> representing the declared return type of the extension function </dd> </dl> </dd> </dl> <hr><a name="MakeFunctionCall()"></a><h3>MakeFunctionCall</h3><pre>public abstract <a href="ExtensionFunctionCall.html">ExtensionFunctionCall</a> <b>MakeFunctionCall</b>()</pre><dl> <dd> <p> Factory method to create an <code>ExtensionFunctionCall</code> object, representing a specific function call in the XSLT or XQuery source code. Saxon will call this method once it has identified that a specific call relates to this extension function. </p> <p> This method must be implemented in every subclass. The implementation should normally instantiate the relevant subclass of <code>ExtensionFunctionCall</code>, and return the new instance. </p> <dl> <dt>returns</dt> <dd> An instance of the appropriate implementation of <code>ExtensionFunctionCall</code> </dd> </dl> </dd> </dl> <hr> </div> </body> </html>