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 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 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 breakpoint
    `MapItem` | `compileXPath​(XPathContext context, java.lang.String exprText, NodeInfo sefElement, MapItem localVariableMap, NodeInfo nsAttribute)` | Compile an XPath expression on behalf of the XX XSLT compiler
    `static 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, java.lang.String xpathDefaultNamespace)` | Parse a SequenceType
    `static void` | `stackTrace​(XPathContext context)` | Method to output a stack trace
    `ExperimentalXPathCompiler` | `withUniformStaticContext​(XPathContext context, NodeInfo sefElement, NodeInfo nsAttribute)` |

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### 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 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
      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 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.

      Parameters:
        `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.
      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,
                                                  java.lang.String xpathDefaultNamespace)
                                           throws XPathException

      Parse a SequenceType
      Throws:
        `XPathException`

    - #### makeMap

          public static MapItem makeMap​(SequenceType st)

    - #### fromMap

          public static SequenceType fromMap​(MapItem typeAsMap)