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 ClassesModifier and TypeClassDescriptionprotected static class
An XSLTContext object holds all the additional dynamic context items used in XSLT. -
Field Summary
Fields inherited from class net.sf.saxon.expr.XPathContextMinor
caller, controller, currentIterator, currentReceiver, isTemporaryDestination, last, origin, stackFrame
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor should only be called by the Controller, which acts as a XPathContext factory.XPathContextMajor
(Item item, Configuration config) Constructor for use in free-standing Java applications. -
Method Summary
Modifier and TypeMethodDescriptionGet 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.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.Get the XSLT-specific part of the contextConstruct a new context as a copy of another.static XPathContextMajor
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.void
Create a new stack frame for local variables, using the supplied SlotManager to define the allocation of slots to individual variablesvoid
requestTailCall
(UserFunction fn, ValueRepresentation[] variables) Reset the local stack frame.void
resetStackFrameMap
(SlotManager map, int numberOfParams) Reset the stack frame variable map, while reusing the StackFrame object itself.void
setCurrentGroupIterator
(GroupIterator collection) Set the current grouping iterator.void
setCurrentMode
(Mode mode) Set the current mode.void
setCurrentRegexIterator
(RegexIterator currentJRegexIterator) Set the current regex iterator.void
setCurrentTemplateRule
(Rule rule) Set the current template.void
setLocalParameters
(ParameterSet localParameters) Set the local parameters for the current template call.void
Set the creating expression (for use in diagnostics).void
setStackFrame
(SlotManager map, ValueRepresentation[] variables) Set the local stack frame.void
setTunnelParameters
(ParameterSet tunnelParameters) Set the tunnel parameters for the current template call.boolean
useLocalParameter
(int fingerprint, LocalParam binding, boolean isTunnel) Use local parameter.Methods inherited from class net.sf.saxon.expr.XPathContextMinor
changeOutputDestination, evaluateLocalVariable, getCaller, getCollation, getConfiguration, getContextItem, getContextPosition, getController, getCurrentIterator, getDefaultCollation, getImplicitTimezone, getLast, getNameChecker, getNamePool, getOrigin, getOriginatingConstructType, getReceiver, getStackFrame, isAtLast, newCleanContext, newMinorContext, setCaller, setCurrentIterator, setLocalVariable, setOriginatingConstructType, setReceiver, setTemporaryReceiver
-
Constructor Details
-
XPathContextMajor
Constructor should only be called by the Controller, which acts as a XPathContext factory. -
XPathContextMajor
Constructor for use in free-standing Java applications.
-
-
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- Specified by:
newContext
in interfaceXPathContext
- Overrides:
newContext
in classXPathContextMinor
-
newContext
-
getXSLTContext
Get the XSLT-specific part of the context- Specified by:
getXSLTContext
in interfaceXPathContext
- Overrides:
getXSLTContext
in classXPathContextMinor
-
getLocalParameters
Get the local parameters for the current template call.- Specified by:
getLocalParameters
in interfaceXPathContext
- Overrides:
getLocalParameters
in 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:
getTunnelParameters
in interfaceXPathContext
- Overrides:
getTunnelParameters
in 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 anInstructionInfoProvider
, allowing information about the calling instruction to be obtained, or null.- Specified by:
setOrigin
in interfaceXPathContext
- Overrides:
setOrigin
in classXPathContextMinor
-
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. -
resetStackFrameMap
Reset the stack frame variable map, while reusing the StackFrame object itself. This is done on a tail call to a different function -
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 -
getTailCallFunction
Determine whether the body of a function is to be repeated, due to tail-recursive function calls -
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:
getCurrentMode
in interfaceXPathContext
- Overrides:
getCurrentMode
in 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
-
getCurrentTemplateRule
Get the current template. This is used to support xsl:apply-imports- Specified by:
getCurrentTemplateRule
in interfaceXPathContext
- Overrides:
getCurrentTemplateRule
in 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:
collection
- 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:
getCurrentGroupIterator
in interfaceXPathContext
- Overrides:
getCurrentGroupIterator
in 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:
currentJRegexIterator
- 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:
getCurrentRegexIterator
in interfaceXPathContext
- Overrides:
getCurrentRegexIterator
in classXPathContextMinor
- Returns:
- the current regular expressions iterator
-
useLocalParameter
public boolean useLocalParameter(int fingerprint, 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- Specified by:
useLocalParameter
in interfaceXPathContext
- Overrides:
useLocalParameter
in classXPathContextMinor
- Parameters:
fingerprint
- The fingerprint of the parameter namebinding
- The XSLParam element to bind its value toisTunnel
- True if a tunnel parameter is required, else false- Returns:
- true if a parameter of this name was supplied, false if not
- Throws:
XPathException
-