| An object representing an XPath variable for use in the JAXP XPath API. The object
is created at compile time when the parser tries to bind a variable reference; the
value is fetched at run-time from the XPathVariableResolver. With this interface,
there is no way of reporting a static error if the variable has not been declared.
In Saxon terms, this class is both a VariableDeclaration and a Binding. Unlike
a normal VariableDeclaration, it isn't created in advance, but is created on demand
when the parser encounters a variable reference. This actually means that if the
XPath expression contains two references to the same variable, two VariableDeclarations
will be created; however, they will be indistinguishable to the VariableResolver.
Acting as a VariableDeclaration, the object goes through the motions of fixing up
a binding to a variable reference (in practice, of course, there is exactly one
reference to the variable). Acting as a run-time binding, it then evaluates the
variable by calling the XPathVariableResolver supplied by the API caller. If no
XPathVariableResolver was supplied, an error is reported when a variable is encountered;
but if the variable resolver doesn't recognize the variable name, it returns null,
which is treated as an empty sequence.
|