Class XSLTemplate

    • Constructor Detail

      • XSLTemplate

        public XSLTemplate()
    • Method Detail

      • getActor

        public NamedTemplate getActor()
        Get the corresponding NamedTemplate object that results from the compilation of this StylesheetComponent
        Specified by:
        getActor in interface StylesheetComponent
        Returns:
        the compiled ComponentCode
      • isDeclaration

        public boolean isDeclaration()
        Ask whether this node is a declaration, that is, a permitted child of xsl:stylesheet (including xsl:include and xsl:import).
        Overrides:
        isDeclaration in class StyleElement
        Returns:
        true for this element
      • isDeferredCompilation

        public boolean isDeferredCompilation​(Compilation compilation)
        Ask whether the compilation of the template should be deferred
        Parameters:
        compilation - the compilation
        Returns:
        true if compilation should be deferred
      • mayContainSequenceConstructor

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

        protected boolean mayContainParam()
        Description copied from class: StyleElement
        Determine whether this type of element is allowed to contain an xsl:param element
        Overrides:
        mayContainParam in class StyleElement
        Returns:
        true if this element is allowed to contain an xsl:param
      • setContextItemRequirements

        public void setContextItemRequirements​(ItemType type,
                                               boolean mayBeOmitted,
                                               boolean absentFocus)
        Set the required context item type. Used when there is an xsl:context-item child element
        Parameters:
        type - the required context item type
        mayBeOmitted - true if the context item may be absent
        absentFocus - true if use=absent is specified
      • isPermittedChild

        protected boolean isPermittedChild​(StyleElement child)
        Specify that xsl:param and xsl:context-item are permitted children
        Overrides:
        isPermittedChild in class StyleElement
        Parameters:
        child - the child that may or may not be permitted
        Returns:
        true if the child is permitted.
      • getTemplateName

        public StructuredQName getTemplateName()
        Return the name of this template. Note that this may be called before prepareAttributes has been called.
        Returns:
        the name of the template as a Structured QName.
      • getSymbolicName

        public SymbolicName getSymbolicName()
        Description copied from interface: StylesheetComponent
        Get the symbolic name of the component, that is, the combination of the component kind and the qualified name
        Specified by:
        getSymbolicName in interface StylesheetComponent
        Returns:
        the component's symbolic name
      • getRequiredContextItemType

        public ItemType getRequiredContextItemType()
      • isMayOmitContextItem

        public boolean isMayOmitContextItem()
      • checkCompatibility

        public void checkCompatibility​(Component component)
        Description copied from interface: StylesheetComponent
        Check the compatibility of this component with another component that it is overriding
        Specified by:
        checkCompatibility in interface StylesheetComponent
        Parameters:
        component - the overridden component
      • prepareAttributes

        public void prepareAttributes()
        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
      • getModeNames

        public StructuredQName[] getModeNames()
                                       throws XPathException
        Return the list of mode names to which this template rule is applicable.
        Returns:
        the list of mode names. If the mode attribute is absent, #default is assumed. If #default is present explicitly or implicitly, it is replaced by the default mode, taken from the in-scope default-modes attribute, which defaults to #unnamed. The unnamed mode is represented by Mode.UNNAMED_MODE_NAME. The token #all translates to Mode.OMNI_MODE.
        Throws:
        XPathException - if the attribute is invalid.
      • getApplicableModes

        public java.util.Set<Mode> getApplicableModes()
                                               throws XPathException
        Get the modes to which this template rule applies
        Returns:
        the set of modes to which it applies
        Throws:
        XPathException - should not happen
      • validate

        public void validate​(ComponentDeclaration decl)
                      throws XPathException
        Description copied from class: StyleElement
        Check that the stylesheet 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
        Parameters:
        decl - the declaration to be validated
        Throws:
        XPathException - if any error is found during validation
      • validateSubtree

        public void validateSubtree​(ComponentDeclaration decl,
                                    boolean excludeStylesheet)
                             throws XPathException
        Description copied from class: StyleElement
        Recursive walk through the stylesheet to validate all nodes
        Overrides:
        validateSubtree in class StyleElement
        Parameters:
        decl - the declaration to be validated
        excludeStylesheet - true if the XSLStylesheet element is to be excluded
        Throws:
        XPathException - if validation fails
      • index

        public void index​(ComponentDeclaration decl,
                          PrincipalStylesheetModule top)
                   throws XPathException
        Description copied from class: StyleElement
        Method supplied by declaration elements to add themselves to a stylesheet-level index
        Overrides:
        index in class StyleElement
        Parameters:
        decl - the Declaration being indexed. (This corresponds to the StyleElement object except in cases where one module is imported several times with different precedence.)
        top - represents the outermost XSLStylesheet or XSLPackage element
        Throws:
        XPathException - if any error is encountered
      • markTailCalls

        public boolean markTailCalls()
        Mark tail-recursive calls on templates and functions.
        Overrides:
        markTailCalls in class StyleElement
        Returns:
        true if one or more tail calls were identified
      • jitCompile

        public void jitCompile​(Compilation compilation,
                               ComponentDeclaration decl)
                        throws XPathException
        Code executed when the template is first executed under JIT. If the template is defined in several modes, then this may be called several times, but it only does anything the first time. Mode-specific processing is done in the TemplateRuleInitializer.
        Parameters:
        compilation - the compilation episode
        decl - the template rule declaration
        Throws:
        XPathException - if anything goes wrong
      • register

        public void register​(ComponentDeclaration declaration)
                      throws XPathException
        Registers the template rule with each Mode that it belongs to.
        Parameters:
        declaration - Associates this template with a stylesheet module (in principle an xsl:template element can be in a document that is imported more than once; these are separate declarations)
        Throws:
        XPathException - if a failure occurs
      • allocatePatternSlotNumbers

        public void allocatePatternSlotNumbers()
        Allocate slot numbers to any local variables declared within a predicate within the match pattern
      • optimize

        public void optimize​(ComponentDeclaration declaration)
                      throws XPathException
        This method is a bit of a misnomer, because it does more than invoke optimization of the template body. In particular, it also registers the template rule with each Mode that it belongs to.
        Specified by:
        optimize in interface StylesheetComponent
        Parameters:
        declaration - Associates this template with a stylesheet module (in principle an xsl:template element can be in a document that is imported more than once; these are separate declarations)
        Throws:
        XPathException - if errors are found
      • getCompiledNamedTemplate

        public NamedTemplate getCompiledNamedTemplate()
        Get the compiled template
        Returns:
        the compiled template
      • getMatch

        public Pattern getMatch()