Package net.sf.saxon.instruct
Class GlobalVariable
java.lang.Object
net.sf.saxon.expr.ComputedExpression
net.sf.saxon.instruct.Instruction
net.sf.saxon.instruct.GeneralVariable
net.sf.saxon.instruct.GlobalVariable
- All Implemented Interfaces:
Serializable,SourceLocator,Binding,Container,Expression,TailCallReturner,InstructionInfoProvider
- Direct Known Subclasses:
GlobalParam
A compiled global variable in a stylesheet or query.
- See Also:
-
Field Summary
Fields inherited from class net.sf.saxon.instruct.GeneralVariable
evaluationMode, nameCode, referenceCount, requiredType, select, slotNumberFields inherited from class net.sf.saxon.expr.ComputedExpression
locationId, staticPropertiesFields inherited from interface net.sf.saxon.expr.Expression
EVALUATE_METHOD, ITERATE_METHOD, PROCESS_METHOD -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionevaluateVariable(XPathContext context) Evaluate the variableGet the executable containing this expressionintGet the host language (XSLT, XQuery, XPath) used to implement the code in this containerGet InstructionInfo for this expressiongetSelectValue(XPathContext context) Evaluate the variable.booleanisGlobal()Is this a global variable?voidlookForCycles(Stack referees) Check for cycles in this variable definitionprocessLeavingTail(XPathContext context) Process the variable declarationvoidThe expression that initializes a global variable may itself use local variables.voidsetExecutable(Executable executable) voidsetHostLanguage(int language) Methods inherited from class net.sf.saxon.instruct.GeneralVariable
display, evaluateItem, getCardinality, getInstructionNameCode, getItemType, getLocalSlotNumber, getNameCode, getRequiredType, getSelectExpression, getSlotNumber, getVariableFingerprint, getVariableName, init, isAssignable, isImplicitlyRequiredParam, isRequiredParam, isTunnelParam, iterate, iterateSubExpressions, optimize, promoteInst, replaceSubExpression, setAssignable, setImplicitlyRequiredParam, setNameCode, setReferenceCount, setRequiredParam, setRequiredType, setSelectExpression, setSlotNumber, setTunnel, setVariableName, simplify, typeCheckMethods inherited from class net.sf.saxon.instruct.Instruction
appendItem, assembleParams, assembleTunnelParams, computeCardinality, computeSpecialProperties, createsNewNodes, dynamicError, evaluateAsString, getImplementationMethod, getSourceLocator, isXSLT, process, promoteMethods inherited from class net.sf.saxon.expr.ComputedExpression
adoptChildExpression, checkPermittedContents, computeDependencies, computeStaticProperties, doPromotion, dynamicError, effectiveBooleanValue, getColumnNumber, getConstructType, getDependencies, getIntrinsicDependencies, getLineNumber, getLocationId, getLocationProvider, getParentExpression, getPublicId, getSlotsUsed, getSpecialProperties, getSystemId, hasBadParentPointer, markTailFunctionCalls, resetStaticProperties, setLocationId, setParentExpression, setParentExpression, suppressValidation, typeErrorMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface javax.xml.transform.SourceLocator
getColumnNumber, getLineNumber, getPublicId, getSystemId
-
Constructor Details
-
GlobalVariable
public GlobalVariable()
-
-
Method Details
-
getExecutable
Description copied from class:ComputedExpressionGet the executable containing this expression- Specified by:
getExecutablein interfaceContainer- Overrides:
getExecutablein classComputedExpression
-
setExecutable
-
setHostLanguage
public void setHostLanguage(int language) -
getHostLanguage
public int getHostLanguage()Description copied from class:ComputedExpressionGet the host language (XSLT, XQuery, XPath) used to implement the code in this container- Specified by:
getHostLanguagein interfaceContainer- Overrides:
getHostLanguagein classComputedExpression- Returns:
- typically
Configuration.XSLTorConfiguration.XQUERY
-
setContainsLocals
The expression that initializes a global variable may itself use local variables. In this case a stack frame needs to be allocated while evaluating the global variable- Parameters:
map- The stack frame map for local variables used while evaluating this global variable.
-
isGlobal
public boolean isGlobal()Is this a global variable?- Specified by:
isGlobalin interfaceBinding- Overrides:
isGlobalin classGeneralVariable- Returns:
- true (yes, it is a global variable)
-
lookForCycles
Check for cycles in this variable definition- Parameters:
referees- the calls leading up to this one; it's an error if this variable is on the stack, because that means it calls itself directly or indirectly. The stack may contain variable definitions (GlobalVariable objects) and user-defined functions (UserFunction objects). It will never contain the same object more than once.- Throws:
StaticError
-
processLeavingTail
Process the variable declaration- Specified by:
processLeavingTailin interfaceTailCallReturner- Specified by:
processLeavingTailin classInstruction- Parameters:
context- The dynamic context of the transformation, giving access to the current node, the current variables, etc.- Returns:
- null if the instruction has completed execution; or a TailCall indicating a function call or template call that is delegated to the caller, to be made after the stack has been unwound so as to save stack space.
- Throws:
XPathException
-
getSelectValue
Evaluate the variable. That is, get the value of the select expression if present or the content of the element otherwise, either as a tree or as a sequence- Overrides:
getSelectValuein classGeneralVariable- Throws:
XPathException
-
evaluateVariable
Evaluate the variable- Throws:
XPathException
-
getInstructionInfo
Get InstructionInfo for this expression- Specified by:
getInstructionInfoin interfaceInstructionInfoProvider- Overrides:
getInstructionInfoin classInstruction
-