Class MessageInstr

All Implemented Interfaces:
ExportAgent, Locatable, IdentityComparable, Traceable

public class MessageInstr extends Instruction
An xsl:message or xsl:assert element in the stylesheet.
  • Constructor Details

    • MessageInstr

      public MessageInstr(Expression select, Expression terminate, Expression errorCode)
      Create an xsl:message instruction
      Parameters:
      select - the expression that constructs the message (composite of the select attribute and the contained sequence constructor)
      terminate - expression that calculates terminate = yes or no.
      errorCode - expression used to compute the error code
  • Method Details

    • getSelect

      public Expression getSelect()
    • setSelect

      public void setSelect(Expression select)
    • getTerminate

      public Expression getTerminate()
    • setTerminate

      public void setTerminate(Expression terminate)
    • getErrorCode

      public Expression getErrorCode()
    • setErrorCode

      public void setErrorCode(Expression errorCode)
    • operands

      public Iterable<Operand> operands()
      Description copied from class: Expression
      Get the immediate sub-expressions of this expression, with information about the relationship of each expression to its parent expression.

      If the expression is a Callable, then it is required that the order of the operands returned by this function is the same as the order of arguments supplied to the corresponding call() method.

      Specified by:
      operands in class Instruction
      Returns:
      an iterator containing the sub-expressions of this expression
    • setIsAssert

      public void setIsAssert(boolean isAssert)
      Say whether this instruction is implementing xsl:message or xsl:assert
      Parameters:
      isAssert - true if this is xsl:assert; false if it is xsl:message
    • copy

      public Expression copy(RebindingMap rebindings)
      Copy an expression. This makes a deep copy.
      Specified by:
      copy in class Expression
      Parameters:
      rebindings - the rebinding map
      Returns:
      the copy of the original expression
    • getInstructionNameCode

      public int getInstructionNameCode()
      Get the name of this instruction for diagnostic and tracing purposes
      Overrides:
      getInstructionNameCode in class Instruction
      Returns:
      a code identifying the instruction: typically but not always the fingerprint of a name in the XSLT namespace
    • getItemType

      public ItemType getItemType()
      Get the item type. To avoid spurious compile-time type errors, we falsely declare that the instruction can return anything
      Overrides:
      getItemType in class Instruction
      Returns:
      AnyItemType
    • getCardinality

      public int getCardinality()
      Get the static cardinality. To avoid spurious compile-time type errors, we falsely declare that the instruction returns zero or one items - this is always acceptable
      Overrides:
      getCardinality in class Expression
      Returns:
      zero or one
    • mayCreateNewNodes

      public final boolean mayCreateNewNodes()
      Determine whether this instruction creates new nodes. This implementation returns true.
      Overrides:
      mayCreateNewNodes in class Instruction
      Returns:
      true if the instruction creates new nodes under some input conditions (or if it can't be proved that it doesn't)
    • optimize

      public Expression optimize(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) throws XPathException
      Perform optimisation of an expression and its subexpressions. This is the third and final phase of static optimization.

      This method is called after all references to functions and variables have been resolved to the declaration of the function or variable, and after all type checking has been done.

      Overrides:
      optimize in class Expression
      Parameters:
      visitor - an expression visitor
      contextInfo - the static type of "." at the point where this expression is invoked. The parameter is set to null if it is known statically that the context item will be undefined. If the type of the context item is not known statically, the argument is set to Type.ITEM_TYPE
      Returns:
      the original expression, rewritten if appropriate to optimize execution
      Throws:
      XPathException - if an error is discovered during this phase (typically a type error)
    • export

      public void export(ExpressionPresenter out) throws XPathException
      Diagnostic print of expression structure. The abstract expression tree is written to the supplied output destination.
      Specified by:
      export in interface ExportAgent
      Specified by:
      export in class Expression
      Parameters:
      out - the expression presenter used to display the structure
      Throws:
      XPathException - if the export fails, for example if an expression is found that won't work in the target environment.
    • getElaborator

      public Elaborator getElaborator()
      Description copied from class: Expression
      Make an elaborator for this expression
      Overrides:
      getElaborator in class Expression
      Returns:
      an appropriate Elaborator