Overview | Package | Class | Deprecated | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## net.sf.saxon.sxpath
Class XPathVariable

    java.lang.Object
      net.sf.saxon.sxpath.XPathVariable

All Implemented Interfaces:
  Serializable, Binding, VariableDeclaration

    public final class XPathVariable

extends Object
implements VariableDeclaration, Binding, Serializable

An object representing an XPath variable for use in the standalone XPath API. The object can only be created by calling the declareVariable method of class StandaloneContext. Note that once declared, this object is thread-safe: it does not hold the actual variable value, which means it can be used with any number of evaluations of a given XPath expression, in series or in parallel.

See Also:
  Serialized Form

Method Summary
`ValueRepresentation` | `evaluateVariable(XPathContext context)` Get the value of the variable.
`int` | `getLocalSlotNumber()` If this is a local variable held on the local stack frame, return the corresponding slot number.
`int` | `getNameCode()` Establish the nameCode of the name of this variable.
`String` | `getVariableName()` Get the name of the variable.
`QNameValue` | `getVariableQName()` Get the name of the variable as a QNameValue.
`boolean` | `isAssignable()` Test whether it is permitted to assign to the variable using the saxon:assign extension element.
`boolean` | `isGlobal()` Indicate whether the binding is local or global.
`void` | `registerReference(BindingReference ref)` Method called by the XPath expression parser to register a reference to this variable.
`void` | `setSlotNumber(int slotNumber)` Set the slot number allocated to this variable

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### isGlobal

    public boolean isGlobal()

  Indicate whether the binding is local or global. A global binding is one that has a fixed value for the life of a query or transformation; any other binding is local.

  Specified by:
    `isGlobal` in interface `Binding`

### isAssignable

    public final boolean isAssignable()

  Test whether it is permitted to assign to the variable using the saxon:assign extension element. This will only be for an XSLT global variable where the extra attribute saxon:assignable="yes" is present.

  Specified by:
    `isAssignable` in interface `Binding`

### setSlotNumber

    public void setSlotNumber(int slotNumber)

  Set the slot number allocated to this variable

  Parameters:
    `slotNumber` -

### getLocalSlotNumber

    public int getLocalSlotNumber()

  If this is a local variable held on the local stack frame, return the corresponding slot number. In other cases, return -1.

  Specified by:
    `getLocalSlotNumber` in interface `Binding`

### getVariableQName

    public QNameValue getVariableQName()

  Get the name of the variable as a QNameValue.

  Returns:
    the name of the variable, as a QNameValue

### getVariableName

    public String getVariableName()

  Get the name of the variable. Used for diagnostic purposes only.

  Specified by:
    `getVariableName` in interface `VariableDeclaration`
  Returns:
    the name of the variable, as a string (containing the raw QName)

### getNameCode

    public int getNameCode()

  Establish the nameCode of the name of this variable.

  Specified by:
    `getNameCode` in interface `VariableDeclaration`
  Returns:
    the nameCode

### registerReference

    public void registerReference(BindingReference ref)

  Method called by the XPath expression parser to register a reference to this variable. This method should not be called by users of the API.

  Specified by:
    `registerReference` in interface `VariableDeclaration`

### evaluateVariable

    public ValueRepresentation evaluateVariable(XPathContext context)

  Get the value of the variable. This method is used by the XPath execution engine to retrieve the value. Note that the value is not held within the variable itself, but within the dunamic context.

  Specified by:
    `evaluateVariable` in interface `Binding`
  Parameters:
    `context` - The dynamic evaluation context
  Returns:
    The value of the variable

Overview | Package | Class | Deprecated | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (C) Michael H. Kay. All rights reserved.