net.sf.saxon.expr

Class XPathContextMajor

public class XPathContextMajor extends XPathContextMinor

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
protected static classXPathContextMajor.XSLTContext
An XSLTContext object holds all the additional dynamic context items used in XSLT.
Constructor Summary
XPathContextMajor(Controller c)
Constructor 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
ValueRepresentationevaluateLocalVariable(int slotnumber)
Get the value of a local variable, identified by its slot number
GroupIteratorgetCurrentGroupIterator()
Get the current group iterator.
ModegetCurrentMode()
Get the current mode.
RegexIteratorgetCurrentRegexIterator()
Get the current regex iterator.
TemplategetCurrentTemplate()
Get the current template.
ParameterSetgetLocalParameters()
Get the local parameters for the current template call.
StackFramegetStackFrame()
Get a reference to the local stack frame for variables.
ParameterSetgetTunnelParameters()
Get the tunnel parameters for the current template call.
XPathContextMajor.XSLTContextgetXSLTContext()
Get the XSLT-specific part of the context
XPathContextMajornewContext()
Construct a new context as a copy of another.
static XPathContextMajornewContext(XPathContextMinor p)
voidopenStackFrame(SlotManager map)
Create a new stack frame for local variables, using the supplied SlotManager to define the allocation of slots to individual variables
voidopenStackFrame(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.
voidsetCurrentGroupIterator(GroupIterator collection)
Set the current grouping iterator.
voidsetCurrentMode(Mode mode)
Set the current mode.
voidsetCurrentRegexIterator(RegexIterator currentJRegexIterator)
Set the current regex iterator.
voidsetCurrentTemplate(Template template)
Set the current template.
voidsetLocalParameters(ParameterSet localParameters)
Set the local parameters for the current template call.
voidsetLocalVariable(int slotnumber, ValueRepresentation value)
Set the value of a local variable, identified by its slot number
voidsetOrigin(InstructionInfoProvider expr)
Set the creating expression (for use in diagnostics).
voidsetStackFrame(SlotManager map, ValueRepresentation[] variables)
Set the local stack frame.
voidsetTunnelParameters(ParameterSet tunnelParameters)
Set the tunnel parameters for the current template call.
booleanuseLocalParameter(int fingerprint, LocalParam binding, boolean isTunnel)
Use local parameter.

Constructor Detail

XPathContextMajor

public XPathContextMajor(Controller c)
Constructor should only be called by the Controller, which acts as a XPathContext factory.

XPathContextMajor

public XPathContextMajor(Item item, Configuration config)
Constructor for use in free-standing Java applications.

Method Detail

evaluateLocalVariable

public ValueRepresentation evaluateLocalVariable(int slotnumber)
Get the value of a local variable, identified by its slot number

getCurrentGroupIterator

public GroupIterator getCurrentGroupIterator()
Get the current group iterator. This supports the current-group() and current-grouping-key() functions in XSLT 2.0

Returns: the current grouped collection

getCurrentMode

public Mode getCurrentMode()
Get the current mode.

Returns: the current mode. May return null if the current mode is the default mode.

getCurrentRegexIterator

public RegexIterator getCurrentRegexIterator()
Get the current regex iterator. This supports the functionality of the regex-group() function in XSLT 2.0.

Returns: the current regular expressions iterator

getCurrentTemplate

public Template getCurrentTemplate()
Get the current template. This is used to support xsl:apply-imports

Returns: the current template

getLocalParameters

public ParameterSet getLocalParameters()
Get the local parameters for the current template call.

Returns: the supplied parameters

getStackFrame

public StackFrame getStackFrame()
Get a reference to the local stack frame for variables. Note that it's the caller's job to make a local copy of this. This is used for creating a Closure containing a retained copy of the variables for delayed evaluation.

Returns: array of variables.

getTunnelParameters

public ParameterSet getTunnelParameters()
Get the tunnel parameters for the current template call.

Returns: the supplied tunnel parameters

getXSLTContext

public XPathContextMajor.XSLTContext getXSLTContext()
Get the XSLT-specific part of the context

newContext

public XPathContextMajor 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

newContext

public static XPathContextMajor newContext(XPathContextMinor p)

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

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.

setCurrentGroupIterator

public void setCurrentGroupIterator(GroupIterator collection)
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

setCurrentMode

public void setCurrentMode(Mode mode)
Set the current mode.

Parameters: mode the new current mode

setCurrentRegexIterator

public void setCurrentRegexIterator(RegexIterator currentJRegexIterator)
Set the current regex iterator. This supports the functionality of the regex-group() function in XSLT 2.0.

Parameters: currentJRegexIterator the current regex iterator

setCurrentTemplate

public void setCurrentTemplate(Template template)
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: template the current template

setLocalParameters

public void setLocalParameters(ParameterSet localParameters)
Set the local parameters for the current template call.

Parameters: localParameters the supplied parameters

setLocalVariable

public void setLocalVariable(int slotnumber, ValueRepresentation value)
Set the value of a local variable, identified by its slot number

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.

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.

setTunnelParameters

public void setTunnelParameters(ParameterSet tunnelParameters)
Set the tunnel parameters for the current template call.

Parameters: tunnelParameters the supplied tunnel parameters

useLocalParameter

public boolean useLocalParameter(int fingerprint, LocalParam binding, boolean isTunnel)
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

Parameters: fingerprint The fingerprint of the parameter name binding The XSLParam element to bind its value to isTunnel True if a tunnel parameter is required, else false

Returns: true if a parameter of this name was supplied, false if not