public class EXPathFileBaseDir.BaseDirCall extends ExtensionFunctionCall
Constructor and Description |
---|
BaseDirCall() |
Modifier and Type | Method and Description |
---|---|
Sequence |
call(XPathContext context,
Sequence[] arguments)
Evaluate this function call at run-time
|
void |
supplyStaticContext(StaticContext context,
int locationId,
Expression[] arguments)
Supply static context information.
|
copyLocalData, effectiveBooleanValue, getDefinition, getStreamingImplementation, rewrite, setDefinition
public Sequence call(XPathContext context, Sequence[] arguments) throws XPathException
ExtensionFunctionCall
call
in interface Callable
call
in class ExtensionFunctionCall
context
- The XPath dynamic evaluation contextarguments
- The values of the arguments to the function call. Each argument value (which is in general
a sequence) is supplied in the form of Sequence
. Any required conversions
to the declared types of the arguments will already have been performed.
If the argument is always a singleton, then the single item may be obtained by calling
arguments[i].head()
.
The implementation is not obliged to read all the items in each SequenceIterator
if they are not required to compute the result; but if any SequenceIterator
is not read
to completion, it is good practice to call its close()
method.
Sequence
.
The implementation is responsible for ensuring that the result is a valid instance of the declared
result type. Saxon will check that this is the case if the ExtensionFunctionDefinition.trustResultType()
method returns false, but it will never convert the supplied result value to the declared result type.
The Sequence
objects used for the arguments will often be instances of LazySequence
,
which means that the items in the sequence are computed lazily on demand. This means that any errors that occur
while computing the sequence might not be thrown until the relevant item is actually read from the sequence.
If the result is a single item, it can be returned directly, since single items all implement Sequence
.
For example a string can be returned as an instance of StringValue
, and a boolean as an instance
of BooleanValue
.
If the result is an empty sequence, the method should return EmptySequence.getInstance()
XPathException
- if a dynamic error occurs during evaluation of the function. The Saxon run-time
code will add information about the error location.public void supplyStaticContext(StaticContext context, int locationId, Expression[] arguments)
ExtensionFunctionCall
This method is called during compilation to provide information about the static context in which the function call appears. If the implementation of the function needs information from the static context, then it should save it now, as it will not be available later at run-time.
The implementation also has the opportunity to examine the expressions that appear in the arguments to the function call at this stage. These might already have been modified from the original expressions as written by the user. The implementation must not modify any of these expressions.
The default implementation of this method does nothing.
supplyStaticContext
in class ExtensionFunctionCall
context
- The static context in which the function call appears. The method must not modify
the static context.locationId
- An integer code representing the location of the call to the extension function
in the stylesheet; can be used in conjunction with the locationMap held in the static context for diagnosticsarguments
- The XPath expressions supplied in the call to this function. The method must not
modify this array, or any of the expressions contained in the array.Copyright (c) 2004-2017 Saxonica Limited. All rights reserved.