Class ExperimentalXPathCompiler

  • public class ExperimentalXPathCompiler
    extends java.lang.Object
    This class provides support to the 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.
    • Method Detail

      • 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
        context - the evaluation context
        exprText - the text of the XPath expression
        sefElement - the element node in the SEF tree containing the XPath expression
        localVariableMap - 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
        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.
        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 of ExpressionTool.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.

        exp - the expression whose range variables need to have slot numbers assigned
        nextFree - the next slot number that is available for allocation
        frame - a SlotManager object that is used to track the mapping of slot numbers to variable names for debugging purposes. May be null.
        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
        s - an identifying string
      • stackTrace

        public static void stackTrace​(XPathContext context)
        Method to output a stack trace