Package net.sf.saxon.expr.instruct

## Class WithParam

- java.lang.Object
- - net.sf.saxon.expr.instruct.WithParam

-     public class WithParam
      extends java.lang.Object

  An object derived from a xsl:with-param element in the stylesheet.

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static WithParam[]` | `EMPTY_ARRAY` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `WithParam()` |

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static WithParam[]` | `copy​(Expression parent, WithParam[] params, RebindingMap rebindings)` | Static method to copy a set of parameters
    `static void` | `exportParameters​(WithParam[] params, ExpressionPresenter out, boolean tunnel)` | Static method to export a set of parameters
    `static void` | `gatherOperands​(Expression parent, WithParam[] params, java.util.List<Operand> list)` | Static method to gather the XPath expressions used in an array of WithParam parameters (add them to the supplied list)
    `EvaluationMode` | `getEvaluationMode()` | Get the evaluation mode of the variable
    `int` | `getInstructionNameCode()` |
    `SequenceType` | `getRequiredType()` | Get the required type of this variable
    `Expression` | `getSelectExpression()` | Get the expression to which this variable is bound
    `Operand` | `getSelectOperand()` | Get the select operand
    `Sequence` | `getSelectValue​(XPathContext context)` | Evaluate the variable.
    `int` | `getSlotNumber()` | Get the slot number allocated to this variable.
    `StructuredQName` | `getVariableQName()` | Get the name of this variable
    `boolean` | `isTypeChecked()` | Ask whether static type checking has been done
    `static void` | `optimize​(ExpressionVisitor visitor, WithParam[] params, ContextItemStaticInfo contextItemType)` | Static method to optimize a set of with-param elements
    `void` | `setRequiredType​(SequenceType required)` | Set the required type of this variable
    `void` | `setSelectExpression​(Expression parent, Expression select)` | Set the expression to which this variable is bound
    `void` | `setSlotNumber​(int s)` | Set the slot number of this variable
    `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
    `void` | `setVariableQName​(StructuredQName s)` | Set the name of the variable
    `static void` | `simplify​(WithParam[] params)` | Static method to simplify a set of with-param elements
    `static void` | `typeCheck​(WithParam[] params, ExpressionVisitor visitor, ContextItemStaticInfo contextItemType)` | Static method to typecheck a set of with-param elements

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### EMPTY_ARRAY

          public static WithParam[] EMPTY_ARRAY

  - ### Constructor Detail

    - #### WithParam

          public WithParam()

  - ### Method Detail

    - #### setSelectExpression

          public void setSelectExpression​(Expression parent,
                                          Expression select)

      Set the expression to which this variable is bound
      Parameters:
        `parent` - the parent expression
        `select` - the initializing expression

    - #### getSelectOperand

          public Operand getSelectOperand()

      Get the select operand

    - #### getSelectExpression

          public Expression getSelectExpression()

      Get the expression to which this variable is bound
      Returns:
        the initializing expression

    - #### setRequiredType

          public void setRequiredType​(SequenceType required)

      Set the required type of this variable
      Parameters:
        `required` - the required type

    - #### getRequiredType

          public SequenceType getRequiredType()

      Get the required type of this variable
      Returns:
        the required type

    - #### getSlotNumber

          public int getSlotNumber()

      Get the slot number allocated to this variable. This is used only for xsl:iterate and xsl:evaluate; template parameters are identified by name, not by slot number.
      Returns:
        the slot number, that is the position allocated to the variable on its stack frame

    - #### setSlotNumber

          public void setSlotNumber​(int s)

      Set the slot number of this variable
      Parameters:
        `s` - the slot number, that is, the position allocated to this variable on its stack frame

    - #### setVariableQName

          public void setVariableQName​(StructuredQName s)

      Set the name of the variable
      Parameters:
        `s` - the name of the variable (a QName)

    - #### getVariableQName

          public StructuredQName getVariableQName()

      Get the name of this variable
      Returns:
        the name of this variable (a QName)

    - #### 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

    - #### getInstructionNameCode

          public int getInstructionNameCode()

    - #### simplify

          public static void simplify​(WithParam[] params)
                               throws XPathException

      Static method to simplify a set of with-param elements
      Parameters:
        `params` - the set of parameters to be simplified
      Throws:
        `XPathException` - if a static error is found

    - #### typeCheck

          public static void typeCheck​(WithParam[] params,
                                       ExpressionVisitor visitor,
                                       ContextItemStaticInfo 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,
                                      ContextItemStaticInfo 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

    - #### getEvaluationMode

          public EvaluationMode getEvaluationMode()

      Get the evaluation mode of the variable
      Returns:
        the evaluation mode (a constant in `EvaluationMode`

    - #### copy

          public static WithParam[] copy​(Expression parent,
                                         WithParam[] params,
                                         RebindingMap rebindings)

      Static method to copy a set of parameters
      Parameters:
        `parent` - the new parent expression
        `params` - the parameters to be copied
      Returns:
        the resulting copy

    - #### gatherOperands

          public static void gatherOperands​(Expression parent,
                                            WithParam[] params,
                                            java.util.List<Operand> list)

      Static method to gather the XPath expressions used in an array of WithParam parameters (add them to the supplied list)
      Parameters:
        `parent` - the containing expression
        `params` - the set of with-param elements to be searched
        `list` - the list to which the subexpressions will be added

    - #### exportParameters

          public static void exportParameters​(WithParam[] params,
                                              ExpressionPresenter out,
                                              boolean tunnel)
                                       throws XPathException

      Static method to export a set of parameters
      Parameters:
        `params` - the set of parameters to be exported
        `out` - the destination for the output
        `tunnel` - true if these are tunnel parameters
      Throws:
        `XPathException`

    - #### getSelectValue

          public Sequence getSelectValue​(XPathContext context)
                                  throws XPathException

      Evaluate the variable. That is, get the value of the select expression if present or the content of the element otherwise, either as a tree or as a sequence
      Parameters:
        `context` - the XPath dynamic context
      Returns:
        the result of evaluating the variable
      Throws:
        `XPathException` - if evaluation of the select expression fails with a dynamic error

    - #### 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