Class XSLTemplate

  • All Implemented Interfaces:
    NodeHandler, NodeInfo, javax.xml.transform.dom.DOMLocator, javax.xml.transform.Source, javax.xml.transform.SourceLocator, org.w3c.dom.Element, org.w3c.dom.NamedNodeMap, org.w3c.dom.Node, org.xml.sax.Locator
    Direct Known Subclasses:
    SAXONHandler

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

      • modeNameCode

        protected int modeNameCode
      • templateFingerprint

        protected int templateFingerprint
      • prioritySpecified

        protected boolean prioritySpecified
      • priority

        protected double priority
      • needsStackFrame

        protected boolean needsStackFrame
    • Constructor Detail

      • XSLTemplate

        public XSLTemplate()
    • Method Detail

      • 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 javax.xml.transform.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:
        javax.xml.transform.TransformerConfigurationException
      • validate

        public void validate()
                      throws javax.xml.transform.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:
        javax.xml.transform.TransformerConfigurationException
      • preprocess

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

        public void process​(Context context)
                     throws javax.xml.transform.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:
        javax.xml.transform.TransformerException
      • start

        public void start​(NodeInfo e,
                          Context context)
                   throws javax.xml.transform.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:
        javax.xml.transform.TransformerException
        See Also:
        NodeInfo
      • traceExpand

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

        protected void expand​(Context context)
                       throws javax.xml.transform.TransformerException
        Expand the template. Called when the template is invoked either by xsl:apply-templates or from xsl:call-template
        Throws:
        javax.xml.transform.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)