Package com.saxonica.ee.extfn
Class ExperimentalXPathCompiler
- java.lang.Object
-
- com.saxonica.ee.extfn.ExperimentalXPathCompiler
-
public class ExperimentalXPathCompiler extends java.lang.Object
This class provides support to the XX (xslt-in-xslt) compiler. The XSLT compiler obtains a single instance of the ExperimentalXPathCompiler for a compilation episode, initializes it with global context information that applies to the package-being-compiled as a whole, and then invokes its compileXPath() method to compile each XPath expression encountered. Note that this code is essentially dormant, because we currently use the XX compiler only with a Javascript XPath compiler; but we don't want to drop the capability to potentially use it in the Java world.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static int
allocateSlots(Expression exp, int nextFree, SlotManager frame)
Allocate slot numbers to range variables.static void
breakpoint(java.lang.String s)
Method that can be called from the XSLT code to trigger a debugger breakpointMapItem
compileXPath(XPathContext context, java.lang.String exprText, NodeInfo sefElement, MapItem localVariableMap, NodeInfo nsAttribute)
Compile an XPath expression on behalf of the XX XSLT compilerstatic SequenceType
fromMap(MapItem typeAsMap)
static ExperimentalXPathCompiler
make(XPathContext context, MapItem globalFunctions, MapItem globalVariables)
static MapItem
makeMap(SequenceType st)
static MapItem
parseSequenceType(XPathContext context, java.lang.String input, NodeInfo nsContext, NamespaceUri xpathDefaultNamespace)
Parse a SequenceTypestatic void
stackTrace(XPathContext context)
Method to output a stack traceExperimentalXPathCompiler
withUniformStaticContext(XPathContext context, NodeInfo sefElement, NodeInfo nsAttribute)
-
-
-
Method Detail
-
make
public static ExperimentalXPathCompiler make(XPathContext context, MapItem globalFunctions, MapItem globalVariables)
-
withUniformStaticContext
public ExperimentalXPathCompiler withUniformStaticContext(XPathContext context, NodeInfo sefElement, NodeInfo nsAttribute)
-
compileXPath
public MapItem compileXPath(XPathContext context, java.lang.String exprText, NodeInfo sefElement, MapItem localVariableMap, NodeInfo nsAttribute) throws XPathException
Compile an XPath expression on behalf of the XX XSLT compiler- Parameters:
context
- the evaluation contextexprText
- the text of the XPath expressionsefElement
- the element node in the SEF tree containing the XPath expressionlocalVariableMap
- map containing information about local variables in the static context. The key of the map is the name of the variable as a QName. The associated value is a sequence of three items: the declaring element in the SEF tree, the slot number, and the declared type of the variable.nsAttribute
- the nearest in-scope ns attribute, containing a whitespace-separated list of prefix=uri namespace bindings- Returns:
- a map representing the compiled expression, with two entries: "expr" for the SEF tree of the expression, and "type" for the static type of the expression.
- Throws:
XPathException
- if XPath parsing fails with a static error
-
allocateSlots
public static int allocateSlots(Expression exp, int nextFree, SlotManager frame)
Allocate slot numbers to range variables. This is a variant ofExpressionTool.allocateSlots(Expression, int, SlotManager)
, which takes into account that variable references may have no target binding, and that some variables will already have slot numbers.This method is only concerned with allocating slot numbers to variables that are declared within the expression itself.
- Parameters:
exp
- the expression whose range variables need to have slot numbers assignednextFree
- the next slot number that is available for allocationframe
- a SlotManager object that is used to track the mapping of slot numbers to variable names for debugging purposes. May be null.- Returns:
- the next unallocated slot number.
-
breakpoint
public static void breakpoint(java.lang.String s)
Method that can be called from the XSLT code to trigger a debugger breakpoint- Parameters:
s
- an identifying string
-
stackTrace
public static void stackTrace(XPathContext context)
Method to output a stack trace
-
parseSequenceType
public static MapItem parseSequenceType(XPathContext context, java.lang.String input, NodeInfo nsContext, NamespaceUri xpathDefaultNamespace) throws XPathException
Parse a SequenceType- Throws:
XPathException
-
makeMap
public static MapItem makeMap(SequenceType st)
-
fromMap
public static SequenceType fromMap(MapItem typeAsMap)
-
-