Package net.sf.saxon.expr
Class XPathContextMajor
java.lang.Object
net.sf.saxon.expr.XPathContextMinor
net.sf.saxon.expr.XPathContextMajor
- All Implemented Interfaces:
XPathContext
This class represents a "major context" in which an XPath expression is evaluated:
a "major context" object allows all aspects of the dynamic context to change, whereas
a "minor context" only allows changes to the focus and the destination for push output.
-
Nested Class Summary
Nested classes/interfaces inherited from class net.sf.saxon.expr.XPathContextMinor
XPathContextMinor.LastValue -
Field Summary
FieldsFields inherited from class net.sf.saxon.expr.XPathContextMinor
caller, controller, currentException, currentIterator, currentReceiver, last, stackFrame -
Constructor Summary
ConstructorsConstructorDescriptionXPathContextMajor(Controller controller) Constructor should only be called by the Controller, which acts as a XPathContext factory.XPathContextMajor(Item item, Configuration config) Deprecated.XPathContextMajor(Item item, Executable exec) Constructor for use in free-standing Java applications. -
Method Summary
Modifier and TypeMethodDescriptionGet a all the variables in the stack frameGet the current group iterator.Get the current mode.Get the current regex iterator.Get the current template.Get the local parameters for the current template call.Get information about the creating expression or other construct.intGet the type of location from which this context was created.Determine whether the body of a function is to be repeated, due to tail-recursive function callsGet the tunnel parameters for the current template call.booleanAsk whether the XSLT output state is "temporary" or "final"Construct a new context as a copy of another.static XPathContextMajornewContext(XPathContextMinor prev) Create a new "major" context (one that is capable of holding a stack frame with local variablesstatic XPathContextMajorvoidopenStackFrame(int numberOfVariables) Create a new stack frame large enough to hold a given number of local variables, for which no stack frame map is available.voidCreate a new stack frame for local variables, using the supplied SlotManager to define the allocation of slots to individual variablesvoidrequestTailCall(UserFunction fn, ValueRepresentation[] variables) Reset the local stack frame.voidresetAllVariableValues(ValueRepresentation[] values) Overwrite all the variables in the stack framevoidresetParameterValues(ValueRepresentation[] values) Overwrite all the parameters in the stack frame.voidresetStackFrameMap(SlotManager map, int numberOfParams) Reset the stack frame variable map, while reusing the StackFrame object itself.voidsetCurrentGroupIterator(GroupIterator iterator) Set the current grouping iterator.voidsetCurrentMode(Mode mode) Set the current mode.voidsetCurrentRegexIterator(RegexIterator currentRegexIterator) Set the current regex iterator.voidsetCurrentTemplateRule(Rule rule) Set the current template.voidsetLocalParameters(ParameterSet localParameters) Set the local parameters for the current template call.voidsetOrigin(InstructionInfo expr) Set the creating expression (for use in diagnostics).voidsetOriginatingConstructType(int loc) Set the type of creating expression (for use in diagnostics).voidsetStackFrame(SlotManager map, ValueRepresentation[] variables) Set the local stack frame.voidsetTemporaryOutputState(boolean temporary) Set the XSLT output state to "temporary" or "final"voidsetTunnelParameters(ParameterSet tunnelParameters) Set the tunnel parameters for the current template call.intuseLocalParameter(int parameterId, int slotNumber, boolean isTunnel) Use local parameter.Methods inherited from class net.sf.saxon.expr.XPathContextMinor
changeOutputDestination, evaluateLocalVariable, getCaller, getCollation, getConfiguration, getContextItem, getController, getCurrentDateTime, getCurrentException, getCurrentIterator, getImplicitTimezone, getLast, getNameChecker, getNamePool, getReceiver, getStackFrame, isAtLast, iterateStackFrames, newCleanContext, newMinorContext, setCaller, setCurrentException, setCurrentIterator, setLocalVariable, setReceiver
-
Field Details
-
isTemporaryDestination
boolean isTemporaryDestination -
origin
Object origin
-
-
Constructor Details
-
XPathContextMajor
Constructor should only be called by the Controller, which acts as a XPathContext factory.- Parameters:
controller- the Controller
-
XPathContextMajor
Constructor for use in free-standing Java applications.- Parameters:
item- the item to use as the initial context item. If this is null, the comtext item is initially undefined (which will cause a dynamic error if it is referenced).exec- the Executable
-
XPathContextMajor
Deprecated.since 9.0 - useXPathContextMajor(Item, Executable)Constructor for use in free-standing Java applications.- Parameters:
item- the item to use as the initial context item. If this is null, the comtext item is initially undefined (which will cause a dynamic error if it is referenced).config- the Saxon Configuration
-
-
Method Details
-
newContext
Construct a new context as a copy of another. The new context is effectively added to the top of a stack, and contains a pointer to the previous context. The- Specified by:
newContextin interfaceXPathContext- Overrides:
newContextin classXPathContextMinor- Returns:
- a new context, created as a copy of this context
-
newContext
Create a new "major" context (one that is capable of holding a stack frame with local variables- Parameters:
prev- the previous context (the one causing the new context to be created)- Returns:
- the new major context
-
newThreadContext
-
getLocalParameters
Get the local parameters for the current template call.- Specified by:
getLocalParametersin interfaceXPathContext- Overrides:
getLocalParametersin classXPathContextMinor- Returns:
- the supplied parameters
-
setLocalParameters
Set the local parameters for the current template call.- Parameters:
localParameters- the supplied parameters
-
getTunnelParameters
Get the tunnel parameters for the current template call.- Specified by:
getTunnelParametersin interfaceXPathContext- Overrides:
getTunnelParametersin classXPathContextMinor- Returns:
- the supplied tunnel parameters
-
setTunnelParameters
Set the tunnel parameters for the current template call.- Parameters:
tunnelParameters- the supplied tunnel parameters
-
setOrigin
Set the creating expression (for use in diagnostics). The origin is generally set to "this" by the object that creates the new context. It's up to the debugger to determine whether this information is useful. The object will either be anExpression, allowing information about the calling instruction to be obtained, or null. -
setOriginatingConstructType
public void setOriginatingConstructType(int loc) Set the type of creating expression (for use in diagnostics). When a new context is created, either this method orsetOrigin(net.sf.saxon.trace.InstructionInfo)should be called.- Parameters:
loc- The originating location: the argument must be one of the integer constants in classLocation
-
getOriginatingConstructType
public int getOriginatingConstructType()Get the type of location from which this context was created. -
getOrigin
Get information about the creating expression or other construct. -
setStackFrame
Set the local stack frame. This method is used when creating a Closure to support delayed evaluation of expressions. The "stack frame" is actually on the Java heap, which means it can survive function returns and the like.- Parameters:
map- the SlotManager, which holds static details of the allocation of variables to slotsvariables- the array of "slots" to hold the actual variable values. This array will be copied if it is too small to hold all the variables defined in the SlotManager
-
resetStackFrameMap
Reset the stack frame variable map, while reusing the StackFrame object itself. This is done on a tail call to a different function- Parameters:
map- the SlotManager representing the stack frame contentsnumberOfParams- the number of parameters required on the new stack frame
-
getAllVariableValues
Get a all the variables in the stack frame- Returns:
- an array holding all the variables, each referenceable by its slot number
-
resetAllVariableValues
Overwrite all the variables in the stack frame- Parameters:
values- an array holding all the variables, each referenceable by its slot number; the caller must ensure this is the correct length (and valid in other ways)
-
resetParameterValues
Overwrite all the parameters in the stack frame. (Used from compiled bytecode)- Parameters:
values- an array holding all the parameters, each referenceable by its slot number; the caller must ensure this is the correct length (and valid in other ways)
-
requestTailCall
Reset the local stack frame. This method is used when processing a tail-recursive function. Instead of the function being called recursively, the parameters are set to new values and the function body is evaluated repeatedly- Parameters:
fn- the user function being called using tail recursionvariables- the parameter to be supplied to the user function
-
getTailCallFunction
Determine whether the body of a function is to be repeated, due to tail-recursive function calls- Returns:
- null if no tail call has been requested, or the name of the function to be called otherwise
-
openStackFrame
Create a new stack frame for local variables, using the supplied SlotManager to define the allocation of slots to individual variables- Parameters:
map- the SlotManager for the new stack frame
-
openStackFrame
public void openStackFrame(int numberOfVariables) Create a new stack frame large enough to hold a given number of local variables, for which no stack frame map is available. This is used in particular when evaluating match patterns of template rules.- Parameters:
numberOfVariables- The number of local variables to be accommodated.
-
setCurrentMode
Set the current mode.- Parameters:
mode- the new current mode
-
getCurrentMode
Get the current mode.- Specified by:
getCurrentModein interfaceXPathContext- Overrides:
getCurrentModein classXPathContextMinor- Returns:
- the current mode. May return null if the current mode is the default mode.
-
setCurrentTemplateRule
Set the current template. This is used to support xsl:apply-imports. The caller is responsible for remembering the previous current template and resetting it after use.- Parameters:
rule- the current template rule, or null to indicate that there is no current template rule
-
getCurrentTemplateRule
Get the current template. This is used to support xsl:apply-imports- Specified by:
getCurrentTemplateRulein interfaceXPathContext- Overrides:
getCurrentTemplateRulein classXPathContextMinor- Returns:
- the current template
-
setCurrentGroupIterator
Set the current grouping iterator. This supports the current-group() and current-grouping-key() functions in XSLT 2.0- Parameters:
iterator- the new current GroupIterator
-
getCurrentGroupIterator
Get the current group iterator. This supports the current-group() and current-grouping-key() functions in XSLT 2.0- Specified by:
getCurrentGroupIteratorin interfaceXPathContext- Overrides:
getCurrentGroupIteratorin classXPathContextMinor- Returns:
- the current grouped collection
-
setCurrentRegexIterator
Set the current regex iterator. This supports the functionality of the regex-group() function in XSLT 2.0.- Parameters:
currentRegexIterator- the current regex iterator
-
getCurrentRegexIterator
Get the current regex iterator. This supports the functionality of the regex-group() function in XSLT 2.0.- Specified by:
getCurrentRegexIteratorin interfaceXPathContext- Overrides:
getCurrentRegexIteratorin classXPathContextMinor- Returns:
- the current regular expressions iterator
-
useLocalParameter
public int useLocalParameter(int parameterId, int slotNumber, boolean isTunnel) throws XPathException Use local parameter. This is called when a local xsl:param element is processed. If a parameter of the relevant name was supplied, it is bound to the xsl:param element. Otherwise the method returns false, so the xsl:param default will be evaluated- Specified by:
useLocalParameterin interfaceXPathContext- Overrides:
useLocalParameterin classXPathContextMinor- Parameters:
parameterId-slotNumber-isTunnel- True if a tunnel parameter is required, else false @return ParameterSet.NOT_SUPPLIED, ParameterSet.SUPPLIED, or ParameterSet.SUPPLIED_AND_CHECKED- Returns:
- ParameterSet.NOT_SUPPLIED, ParameterSet.SUPPLIED, or ParameterSet.SUPPLIED_AND_CHECKED
- Throws:
XPathException
-
setTemporaryOutputState
public void setTemporaryOutputState(boolean temporary) Set the XSLT output state to "temporary" or "final"- Parameters:
temporary- set to true to set temporary output state; false to set final output state
-
isTemporaryOutputState
public boolean isTemporaryOutputState()Ask whether the XSLT output state is "temporary" or "final"- Specified by:
isTemporaryOutputStatein interfaceXPathContext- Overrides:
isTemporaryOutputStatein classXPathContextMinor- Returns:
- true to set temporary output state; false to set final output state
-
XPathContextMajor(Item, Executable)