com.icl.saxon.expr

Class NodeSetExpression

public abstract class NodeSetExpression extends Expression

A NodeSetExpression is any expression denoting a set of nodes.
This is an abstract class, the methods are defaults which may be overridden in subclasses
Method Summary
abstract NodeEnumerationenumerate(Context context, boolean sorted)
Return a node enumeration.
Valueevaluate(Context context)
Evaluate this node-set.
booleanevaluateAsBoolean(Context context)
Evaluate as a boolean.
NodeSetValueevaluateAsNodeSet(Context context)
Evaluate an expression as a NodeSet.
StringevaluateAsString(Context context)
Evaluate as a string.
intgetDataType()
Determine the data type of the exprssion, if possible
voidoutputStringValue(Outputter out, Context context)
Evaluate an expression as a String and write the result to the specified outputter.
NodeInfoselectFirst(Context context)
Return the first node selected by this Expression when evaluated in the current context

Method Detail

enumerate

public abstract NodeEnumeration enumerate(Context context, boolean sorted)
Return a node enumeration. All NodeSetExpressions must implement this method: the evaluate() function is defined in terms of it. (But note that some expressions that return node-sets are not NodeSetExpressions: for example functions such as key(), id(), and document() are not, and neither are variable references).

Parameters: context The evaluation context sorted True if the nodes must be returned in document order

evaluate

public Value evaluate(Context context)
Evaluate this node-set. This doesn't actually retrieve all the nodes: it returns a wrapper around a node-set expression in which all context dependencies have been eliminated.

evaluateAsBoolean

public boolean evaluateAsBoolean(Context context)
Evaluate as a boolean. Returns true if there are any nodes selected by the NodeSetExpression

Parameters: context The context in which the expression is to be evaluated

Returns: true if there are any nodes selected by the NodeSetExpression

evaluateAsNodeSet

public NodeSetValue evaluateAsNodeSet(Context context)
Evaluate an expression as a NodeSet.

Parameters: context The context in which the expression is to be evaluated

Returns: the value of the expression, evaluated in the current context

evaluateAsString

public String evaluateAsString(Context context)
Evaluate as a string. Returns the string value of the first node selected by the NodeSetExpression

Parameters: context The context in which the expression is to be evaluated

Returns: the value of the NodeSetExpression, evaluated in the current context

getDataType

public int getDataType()
Determine the data type of the exprssion, if possible

Returns: Value.NODESET

outputStringValue

public void outputStringValue(Outputter out, Context context)
Evaluate an expression as a String and write the result to the specified outputter.

Parameters: context The context in which the expression is to be evaluated

Returns: the value of the expression, evaluated in the current context

selectFirst

public NodeInfo selectFirst(Context context)
Return the first node selected by this Expression when evaluated in the current context

Parameters: context The context for the evaluation

Returns: the NodeInfo of the first node in document order, or null if the node-set is empty.