Class XSLTemplate

All Implemented Interfaces:
NodeHandler, NodeInfo, DOMLocator, Source, SourceLocator, Element, NamedNodeMap, Node, Locator
Direct Known Subclasses:
SAXONHandler

public class XSLTemplate extends StyleElement implements NodeHandler
An xsl:template element in the style sheet.
  • Field Details

    • modeNameCode

      protected int modeNameCode
    • templateFingerprint

      protected int templateFingerprint
    • match

      protected Pattern match
    • prioritySpecified

      protected boolean prioritySpecified
    • priority

      protected double priority
    • procedure

      protected Procedure procedure
    • needsStackFrame

      protected boolean needsStackFrame
  • Constructor Details

    • XSLTemplate

      public XSLTemplate()
  • Method Details

    • mayContainTemplateBody

      public boolean mayContainTemplateBody()
      Determine whether this type of element is allowed to contain a template-body
      Overrides:
      mayContainTemplateBody in class StyleElement
      Returns:
      true: yes, it may contain a template-body
    • getTemplateFingerprint

      public int getTemplateFingerprint()
      Return the fingerprint for the name of this template
    • getMinImportPrecedence

      public int getMinImportPrecedence()
    • needsStackFrame

      public boolean needsStackFrame()
      Description copied from interface: NodeHandler
      Optimization hint to allow a handler to declare that it needs no stack space for local variables and parameters
      Specified by:
      needsStackFrame in interface NodeHandler
    • prepareAttributes

      public void prepareAttributes() throws TransformerConfigurationException
      Description copied from class: StyleElement
      Set the attribute list for the element. This is called to process the attributes (note the distinction from processAttributes in the superclass). Must be supplied in a subclass
      Specified by:
      prepareAttributes in class StyleElement
      Throws:
      TransformerConfigurationException
    • validate

      public void validate() throws TransformerConfigurationException
      Description copied from class: StyleElement
      Check that the element is valid. This is called once for each element, after the entire tree has been built. As well as validation, it can perform first-time initialisation. The default implementation does nothing; it is normally overriden in subclasses.
      Overrides:
      validate in class StyleElement
      Throws:
      TransformerConfigurationException
    • preprocess

      public void preprocess() throws TransformerConfigurationException
      Preprocess: this registers the template with the rule manager, and ensures space is available for local variables
      Overrides:
      preprocess in class StyleElement
      Throws:
      TransformerConfigurationException
    • process

      public void process(Context context) throws TransformerException
      Process template. This is called while all the top-level nodes are being processed in order, so it does nothing.
      Specified by:
      process in class StyleElement
      Parameters:
      context - The context in the source XML document, giving access to the current node, the current variables, etc.
      Throws:
      TransformerException
    • start

      public void start(NodeInfo e, Context context) throws TransformerException
      Process a node in the source document. This is called when the template is invoked using xsl:apply-templates.
      Specified by:
      start in interface NodeHandler
      Parameters:
      e - The NodeInfo object for the current node.
      Throws:
      TransformerException
      See Also:
    • traceExpand

      protected void traceExpand(Context context) throws TransformerException
      Expand the template, with tracing. Called when the template is invoked either by xsl:apply-templates or from xsl:call-template
      Throws:
      TransformerException
    • expand

      protected void expand(Context context) throws TransformerException
      Expand the template. Called when the template is invoked either by xsl:apply-templates or from xsl:call-template
      Throws:
      TransformerException
    • bindVariable

      public Binding bindVariable(int fingerprint) throws XPathException
      Disallow variable references in the match pattern
      Overrides:
      bindVariable in class StyleElement
      Parameters:
      fingerprint - The fingerprint of the name of the variable
      Returns:
      a Binding for the variable
      Throws:
      XPathException - if the variable has not been declared
    • getProcedure

      public Procedure getProcedure()
      Get associated Procedure (for details of stack frame)