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.
getTailCallFunction
public UserFunction getTailCallFunction()
Determine whether the body of a function is to be repeated, due to tail-recursive function calls
- null if no tail call has been requested, or the name of the function to be called otherwise
newContext
public static XPathContextMajor newContext(XPathContextMinor prev)
Create a new "major" context (one that is capable of holding a stack frame with local variables
prev
- the previous context (the one causing the new context to be created)
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.
numberOfVariables
- The number of local variables to be accommodated.
openStackFrame
public void openStackFrame(SlotManager map)
Create a new stack frame for local variables, using the supplied SlotManager to
define the allocation of slots to individual variables
map
- the SlotManager for the new stack frame
requestTailCall
public void requestTailCall(UserFunction fn,
ValueRepresentation[] variables)
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
fn
- the user function being called using tail recursionvariables
- the parameter to be supplied to the user function
resetStackFrameMap
public void resetStackFrameMap(SlotManager map,
int numberOfParams)
Reset the stack frame variable map, while reusing the StackFrame object itself. This
is done on a tail call to a different function
map
- the SlotManager representing the stack frame contentsnumberOfParams
- the number of parameters required on the new stack frame
setCurrentGroupIterator
public void setCurrentGroupIterator(GroupIterator iterator)
Set the current grouping iterator. This supports the current-group() and
current-grouping-key() functions in XSLT 2.0
iterator
- the new current GroupIterator
setCurrentMode
public void setCurrentMode(Mode mode)
Set the current mode.
mode
- the new current mode
setCurrentRegexIterator
public void setCurrentRegexIterator(RegexIterator currentRegexIterator)
Set the current regex iterator. This supports the functionality of the regex-group()
function in XSLT 2.0.
currentRegexIterator
- the current regex iterator
setCurrentTemplateRule
public void setCurrentTemplateRule(Rule rule)
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.
rule
- the current template rule
setLocalParameters
public void setLocalParameters(ParameterSet localParameters)
Set the local parameters for the current template call.
localParameters
- the supplied parameters
setOrigin
public void setOrigin(InstructionInfoProvider expr)
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 an
InstructionInfoProvider
, allowing information
about the calling instruction to be obtained, or null.
- setOrigin in interface XPathContext
- setOrigin in interface XPathContextMinor
setStackFrame
public void setStackFrame(SlotManager map,
ValueRepresentation[] variables)
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.
map
- the SlotManager, which holds static details of the allocation of variables to slotsvariables
- the array of "slots" to hold the actual variable values
setTunnelParameters
public void setTunnelParameters(ParameterSet tunnelParameters)
Set the tunnel parameters for the current template call.
tunnelParameters
- the supplied tunnel parameters
useLocalParameter
public boolean useLocalParameter(StructuredQName qName,
LocalParam binding,
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
- useLocalParameter in interface XPathContext
- useLocalParameter in interface XPathContextMinor
qName
- The fingerprint of the parameter namebinding
- The XSLParam element to bind its value toisTunnel
- True if a tunnel parameter is required, else false
- true if a parameter of this name was supplied, false if not