org.apache.xpath.operations
Class Variable

java.lang.Object
  |
  +--org.apache.xpath.Expression
        |
        +--org.apache.xpath.operations.Variable

public class Variable
extends Expression

The variable reference expression executer.

See Also:
Serialized Form

Constructor Summary
Variable()
           
 
Method Summary
 XObject execute(XPathContext xctxt)
          Dereference the variable, and return the reference value.
 void fixupVariables(java.util.Vector vars, int globalsSize)
          This function is used to fixup variables from QNames to stack frame indexes at stylesheet build time.
 boolean isStableNumber()
          Tell if this expression returns a stable number that will not change during iterations within the expression.
 void setQName(QName qname)
          Set the qualified name of the variable.
 
Methods inherited from class org.apache.xpath.Expression
asIterator, asNode, assertion, bool, canTraverseOutsideSubtree, error, execute, execute, executeCharsToContentHandler, isNodesetExpr, num, setSourceLocator, warn, xstr
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Variable

public Variable()
Method Detail

fixupVariables

public void fixupVariables(java.util.Vector vars,
                           int globalsSize)
This function is used to fixup variables from QNames to stack frame indexes at stylesheet build time.
Parameters:
vars - List of QNames that correspond to variables. This list should be searched backwards for the first qualified name that corresponds to the variable reference qname. The position of the QName in the vector from the start of the vector will be its position in the stack frame (but variables above the globalsTop value will need to be offset to the current stack frame).
Overrides:
fixupVariables in class Expression

setQName

public void setQName(QName qname)
Set the qualified name of the variable.
Parameters:
qname - Must be a non-null reference to a qualified name.

execute

public XObject execute(XPathContext xctxt)
                throws javax.xml.transform.TransformerException
Dereference the variable, and return the reference value. Note that lazy evaluation will occur. If a variable within scope is not found, a warning will be sent to the error listener, and an empty nodeset will be returned.
Parameters:
xctxt - The runtime execution context.
Returns:
The evaluated variable, or an empty nodeset if not found.
Throws:
javax.xml.transform.TransformerException -  
Overrides:
execute in class Expression

isStableNumber

public boolean isStableNumber()
Tell if this expression returns a stable number that will not change during iterations within the expression. This is used to determine if a proximity position predicate can indicate that no more searching has to occur.
Returns:
true if the expression represents a stable number.
Overrides:
isStableNumber in class Expression


Copyright © 2001 Apache XML Project. All Rights Reserved.