Class WherePopulated

All Implemented Interfaces:
ExportAgent, ItemMappingFunction, Locatable, IdentityComparable, Traceable

public class WherePopulated extends UnaryExpression implements ItemMappingFunction
A compiled xsl:where-populated instruction (formerly xsl:conditional-content).
  • Constructor Details

    • WherePopulated

      public WherePopulated(Expression base)
      Create the instruction
      Parameters:
      base - the base expression
  • Method Details

    • isInstruction

      public boolean isInstruction()
      Ask whether this expression is an instruction. In XSLT streamability analysis this is used to distinguish constructs corresponding to XSLT instructions from other constructs.
      Overrides:
      isInstruction in class Expression
      Returns:
      true if this construct originates as an XSLT instruction
    • getOperandRole

      protected OperandRole getOperandRole()
      Get the usage (in terms of streamability analysis) of the single operand
      Specified by:
      getOperandRole in class UnaryExpression
      Returns:
      the operand usage
    • copy

      public Expression copy(RebindingMap rebindings)
      Description copied from class: Expression
      Copy an expression. This makes a deep copy.
      Specified by:
      copy in class Expression
      Parameters:
      rebindings - a mutable list of (old binding, new binding) pairs that is used to update the bindings held in any local variable references that are copied.
      Returns:
      the copy of the original expression
    • getImplementationMethod

      public int getImplementationMethod()
      An implementation of Expression must provide at least one of the methods evaluateItem(), iterate(), or process(). This method indicates which of these methods is provided directly. The other methods will always be available indirectly, using an implementation that relies on one of the other methods.
      Specified by:
      getImplementationMethod in class Expression
      Returns:
      the implementation method, for example Expression.ITERATE_METHOD or Expression.EVALUATE_METHOD or Expression.PROCESS_METHOD
    • computeCardinality

      protected int computeCardinality()
      Description copied from class: UnaryExpression
      Determine the static cardinality. Default implementation returns the cardinality of the operand
      Overrides:
      computeCardinality in class UnaryExpression
      Returns:
      the computed cardinality, as one of the values StaticProperty.ALLOWS_ZERO_OR_ONE, StaticProperty.EXACTLY_ONE, StaticProperty.ALLOWS_ONE_OR_MORE, StaticProperty.ALLOWS_ZERO_OR_MORE. May also return StaticProperty.ALLOWS_ZERO if the result is known to be an empty sequence, or StaticProperty.ALLOWS_MANY if if is known to return a sequence of length two or more.
    • iterate

      public SequenceIterator iterate(XPathContext context) throws XPathException
      Return an Iterator to iterate over the values of a sequence. The value of every expression can be regarded as a sequence, so this method is supported for all expressions.
      Overrides:
      iterate in class Expression
      Parameters:
      context - supplies the context for evaluation
      Returns:
      a SequenceIterator that can be used to iterate over the result of the expression
      Throws:
      XPathException - if any dynamic error occurs evaluating the expression
    • process

      public void process(Outputter output, XPathContext context) throws XPathException
      Process the instruction, without returning any tail calls
      Overrides:
      process in class Expression
      Parameters:
      output - the destination for the result
      context - The dynamic context, giving access to the current node, the current variables, etc.
      Throws:
      XPathException - if a dynamic error occurs
    • mapItem

      public Item mapItem(Item item) throws XPathException
      Map one item to another item.
      Specified by:
      mapItem in interface ItemMappingFunction
      Parameters:
      item - The input item to be mapped.
      Returns:
      either the output item, or null.
      Throws:
      XPathException - if a dynamic error occurs
    • isDeemedEmpty

      public static boolean isDeemedEmpty(Item item)
      Test whether an item is empty according to the definition in the spec for xsl:conditional-content
      Parameters:
      item - the item to be tested
      Returns:
      true if it is "empty", for example, an element without children
    • getExpressionName

      public String getExpressionName()
      Get a name identifying the kind of expression, in terms meaningful to a user.
      Overrides:
      getExpressionName in class Expression
      Returns:
      a name identifying the kind of expression, in terms meaningful to a user. The name will always be in the form of a lexical XML QName, and should usually match the name used in export() output displaying the expression, unless compatibility constraints intervene.
    • export

      public void export(ExpressionPresenter out) throws XPathException
      Description copied from class: UnaryExpression
      Diagnostic print of expression structure. The abstract expression tree is written to the supplied output destination.
      Specified by:
      export in interface ExportAgent
      Overrides:
      export in class UnaryExpression
      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.
    • getStreamerName

      public String getStreamerName()
      Get the (partial) name of a class that supports streaming of this kind of expression
      Overrides:
      getStreamerName in class Expression
      Returns:
      the partial name of a class that can be instantiated to provide streaming support in Saxon-EE, or null if there is no such class
    • getElaborator

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