Class WithParam

  • All Implemented Interfaces:
    javax.xml.transform.SourceLocator, Binding

    public class WithParam
    extends GeneralVariable
    An object derived from a xsl:with-param element in the stylesheet.
    • Field Detail

      • EMPTY_ARRAY

        public static WithParam[] EMPTY_ARRAY
      • parameterId

        int parameterId
      • typeChecked

        boolean typeChecked
    • Constructor Detail

      • WithParam

        public WithParam()
    • Method Detail

      • setParameterId

        public void setParameterId​(int id)
        Allocate a number which is essentially an alias for the parameter name, unique within a stylesheet
        Parameters:
        id - the parameter id
      • setTypeChecked

        public void setTypeChecked​(boolean checked)
        Say whether this parameter will have been typechecked by the caller to ensure it satisfies the required type, in which case the callee need not do a dynamic type check
        Parameters:
        checked - true if the caller has done static type checking against the required type
      • getParameterId

        public int getParameterId()
        Get the parameter id, which is essentially an alias for the parameter name, unique within a stylesheet
        Returns:
        the parameter id
      • getInstructionNameCode

        public int getInstructionNameCode()
        Description copied from class: GeneralVariable
        Get the name of this instruction (that is xsl:variable, xsl:param etc) for diagnostics
        Overrides:
        getInstructionNameCode in class GeneralVariable
        Returns:
        the name of this instruction, as a name pool name code
      • simplify

        public static void simplify​(WithParam[] params,
                                    ExpressionVisitor visitor)
                             throws XPathException
        Static method to simplify a set of with-param elements
        Parameters:
        params - the set of parameters to be simplified
        visitor - the expression visitor
        Throws:
        XPathException - if a static error is found
      • typeCheck

        public static void typeCheck​(WithParam[] params,
                                     ExpressionVisitor visitor,
                                     ExpressionVisitor.ContextItemType contextItemType)
                              throws XPathException
        Static method to typecheck a set of with-param elements
        Parameters:
        params - the set of parameters to be checked
        visitor - the expression visitor
        contextItemType - static information about the context item type and existence
        Throws:
        XPathException - if a static error is found
      • optimize

        public static void optimize​(ExpressionVisitor visitor,
                                    WithParam[] params,
                                    ExpressionVisitor.ContextItemType contextItemType)
                             throws XPathException
        Static method to optimize a set of with-param elements
        Parameters:
        params - the set of parameters to be optimized
        visitor - the expression visitor
        contextItemType - static information about the context item type and existence
        Throws:
        XPathException - if a static error is found
      • promoteParams

        public static void promoteParams​(Expression parent,
                                         WithParam[] params,
                                         PromotionOffer offer)
                                  throws XPathException
        Static method to do expression promotion on a set of with-param elements
        Parameters:
        parent - the parent instruction (for example apply-templates or call-template)
        params - the set of parameters to be be investigated for promotion
        offer - the promotion offer to be passed to subexpressions
        Throws:
        XPathException - if a static error is found
      • copy

        public static WithParam[] copy​(WithParam[] params)
        Static method to copy a set of parameters
        Parameters:
        params - the parameters to be copied
        Returns:
        the resulting copy
      • gatherXPathExpressions

        public static void gatherXPathExpressions​(WithParam[] params,
                                                  java.util.List<Expression> list)
        Static method to gather the XPath expressions used in an array of WithParam parameters (add them to the supplied list)
        Parameters:
        params - the set of with-param elements to be searched
        list - the list to which the subexpressions will be added
      • explainParameters

        public static void explainParameters​(WithParam[] params,
                                             ExpressionPresenter out)
        Static method to explain a set of parameters
        Parameters:
        params - the set of parameters to be explained
        out - the destination for the explanation
      • replaceXPathExpression

        public static boolean replaceXPathExpression​(WithParam[] params,
                                                     Expression original,
                                                     Expression replacement)
        Static method to replace a subexpression within any parameter within which it is found
        Parameters:
        params - the set of parameters to be examined
        original - the subexpression to be replaced
        replacement - the replacement expression
        Returns:
        true if a replacement was made
      • evaluateVariable

        public ValueRepresentation evaluateVariable​(XPathContext context)
                                             throws XPathException
        Evaluate the variable (method exists only to satisfy the interface)
        Parameters:
        context - the XPath dynamic evaluation context
        Returns:
        the result of evaluating the variable
        Throws:
        XPathException - if an error occurs while evaluating the variable
      • isTypeChecked

        public boolean isTypeChecked()
        Ask whether static type checking has been done
        Returns:
        true if the caller has done static type checking against the type required by the callee