Class FirstItemExpression

All Implemented Interfaces:
Serializable, SourceLocator, LocationProvider, SaxonLocator, InstructionInfo, Locator

public final class FirstItemExpression extends SingleItemFilter
A FirstItemExpression returns the first item in the sequence returned by a given base expression
See Also:
  • Method Details

    • makeFirstItemExpression

      public static Expression makeFirstItemExpression(Expression base)
      Static factory method
      Parameters:
      base - A sequence expression denoting sequence whose first item is to be returned
      Returns:
      the FirstItemExpression, or an equivalent
    • copy

      public Expression copy()
      Copy an expression. This makes a deep copy.
      Specified by:
      copy in class Expression
      Returns:
      the copy of the original expression
    • evaluateItem

      public Item evaluateItem(XPathContext context) throws XPathException
      Evaluate the expression
      Overrides:
      evaluateItem in class Expression
      Parameters:
      context - The context in which the expression is to be evaluated
      Returns:
      the node or atomic value that results from evaluating the expression; or null to indicate that the result is an empty sequence
      Throws:
      XPathException - if any dynamic error occurs evaluating the expression
    • getExpressionName

      public String getExpressionName()
      Description copied from class: Expression
      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 match the name used in explain() output displaying the expression.