Package net.sf.saxon.trans
Interface GlobalVariableManager
- All Known Implementing Classes:
PrincipalStylesheetModule
,PrincipalStylesheetModuleEE
public interface GlobalVariableManager
This interface provides access to a collection of global variables. This abstraction is used by the optimizer
to handle the rather different ways that global variables are managed in XSLT and XQuery, as a result of
XSLT packaging.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addGlobalVariable
(GlobalVariable variable) Add a global variable to the collectiongetEquivalentVariable
(Expression select) Get an existing global variable whose initializer is a given expression, if there is one.
-
Method Details
-
getEquivalentVariable
Get an existing global variable whose initializer is a given expression, if there is one. Note that this depends on the logic for detecting equivalence of expressions, which is necessarily approximate. Expressions with dependencies on the static context should never be considered equivalent. If no equivalent global variable is found, return null. An implementation can always return null if it wants to avoid a lengthy search.- Parameters:
select
- the expression to which the variable is bound- Returns:
- an existing global variable with the same select expression, if one can be found; otherwise null.
-
addGlobalVariable
Add a global variable to the collection- Parameters:
variable
- the variable to be added- Throws:
XPathException
- if errors occur (some implementations of the method have side-effects, such as causing the variable declaration to be compiled)
-