Package net.sf.saxon.pattern

## Class PatternMaker

- java.lang.Object
- - net.sf.saxon.pattern.PatternMaker

-     public class PatternMaker
      extends java.lang.Object

  This is a singleton class used to convert an expression to an equivalent pattern. This version of the class is used to generate conventional XSLT match patterns; there is another version used to generate patterns suitable for streamed evaluation in Saxon-EE.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `PatternMaker()` |

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static Pattern` | `fromExpression​(Expression expression, Configuration config, boolean is30)` | Static factory method to make a pattern by converting an expression.
    `static int` | `getAxisForPathStep​(Expression step)` |

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

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

- - ### Constructor Detail

    - #### PatternMaker

          public PatternMaker()

  - ### Method Detail

    - #### fromExpression

          public static Pattern fromExpression​(Expression expression,
                                               Configuration config,
                                               boolean is30)
                                        throws XPathException

      Static factory method to make a pattern by converting an expression. The supplied expression is the equivalent expression to the pattern, in the sense that it takes the same syntactic form.

      Note that this method does NOT check all the rules for XSLT patterns; it deliberately allows a (slightly) wider class of expressions to be converted than XSLT allows.

      The expression root() at the start of the expression has a special meaning: it refers to the root of the subtree in which the pattern must match, which can be supplied at run-time during pattern matching. This is used for patterns that represent streamable path expressions.

      Parameters:
        `expression` - the expression to be converted, which must already have been simplified and type-checked
        `config` - the Saxon configuration
        `is30` - set to true if XSLT 3.0 syntax is to be accepted
      Returns:
        the compiled pattern
      Throws:
        `XPathException` - if the expression cannot be converted

    - #### getAxisForPathStep

          public static int getAxisForPathStep​(Expression step)
                                        throws XPathException

      Throws:
        `XPathException`