Class LoopLifter

  • public class LoopLifter
    extends java.lang.Object
    Class to handle loop-lifting optimization, that is, extraction of subexpressions appearing within a loop when there is no dependency on the controlling variable of the loop. This handles both focus-dependent loops (such as xsl:for-each) and variable-dependent loops (such as XPath for-expressions), and also takes into account specialist loops such as xsl:for-each-group, xsl:merge, and xsl:analyze-string. The class is instantiated to perform optimization of a component such as a function or template, and it contains temporary instance-level data pertaining to that function or template.
    • Method Detail

      • process

        public static Expression process​(Expression exp,
                                         ExpressionVisitor visitor,
                                         ContextItemStaticInfo contextInfo)
                                  throws XPathException
        Apply loop-lifting to an expression (typically the body of a template or function)
        exp - the expression to which loop lifting is applied
        visitor - the expression visitor
        contextInfo - the static type of the context item
        the optimized expression
        XPathException - if any error occurs
      • gatherInfo

        public void gatherInfo​(Expression exp)
        Gather information about an expression. The information (in the form of an ExpInfo object) is added to the expInfoMap, which is indexed by expression.
        exp - the expression for which information is required