Class TemplateRegistry

java.lang.Object
eu.bandm.tools.xslt.base.TemplateRegistry

public class TemplateRegistry extends Object
Stores and organizes template codes and retrieves the best fitting for a given element. For execution speed, there are direct look-ups for the FINAL/lowest-level TPath.Step element for the diverse node/test kinds. The indexing scheme is given with the data definition in Rt.
  • Field Details

    • priority_tag_with_context

      public static final Double priority_tag_with_context
      Default priorities, see [XSLT 1.0:5.5. listpoint 2]
    • priority_keyOrId

      public static final Double priority_keyOrId
    • priority_full_tag

      public static final Double priority_full_tag
    • priority_nsuri_only

      public static final Double priority_nsuri_only
    • priority_kind_only

      public static final Double priority_kind_only
    • allIds

      public final Set<String> allIds
    • transformation

      final Transformation transformation
      needed for namespace contexts and msg.
    • tpathCache

      final TPathCache tpathCache
    • templatesByMode

      Toplevel Map, by mode.
  • Constructor Details

  • Method Details

    • templateDir

      Rt.TemplatesByKind templateDir(NamespaceName mode, Double prior)
    • add

      public void add(eu.bandm.tools.xslt.tdom.Element_xsl_template t, String match, NamespaceName mode, String priority)
      Add a template with match expression, mode and priority. The match expression is parsed as a tpath expression, and must be conformant to certain restrictions.
    • addFunction

      void addFunction(eu.bandm.tools.xslt.tdom.Element_xsl_template t, TPathCache.PatternPart pp, TPath.FunctionCall fc, NamespaceName mode, Double prior)
      Called iff function call is the rightmost (ie. only) expression (see a). (Currently only "key()" and "id()" are permitted as functions.)
      Functions at the START of a pattern (see b) are treated as "rooted patterns" like those in (c). They are stored indexed by their RIGHT-most Step and tested later from right to left.
        (a)  "id('myId')"
        (b)  "id('myId')//p/@motto"
        (c)  "/body//p/@motto"
        
    • addRoot

      void addRoot(eu.bandm.tools.xslt.tdom.Element_xsl_template t, TPathCache.PatternPart pp, NamespaceName mode, Double prior)
    • checkAdd

      protected boolean checkAdd(Rt.TemplateEntry old, eu.bandm.tools.xslt.tdom.Element_xsl_template candidate, String text)
    • addStep

      void addStep(eu.bandm.tools.xslt.tdom.Element_xsl_template t, TPathCache.PatternPart pp, TPath.Step fc, NamespaceName mode, Double prior)
      The structure of a PatternPart (i.e. under the possible toplevel disjunction="|" in the pattern) is a sequence of tests connected by "/" and "//", thus using the "child" or "descendant" axis. The TPath realization goes bottom up, using "Step.base" to point to the left neighbour in frontend notation. This is finally "null", means a "relative" pattern, or "root", means top-level start, or a function call ("id(..)" or "key(..)"). Tests for categories other than "element" ("pi", "text", "comment" etc) can only appear at the right-most position, because these nodes do not have children.
    • dump

      public void dump(PrintStream p0)