## net.sf.saxon.functions
Class Id

    java.lang.Object
      |
      +--net.sf.saxon.expr.ComputedExpression
            |
            +--net.sf.saxon.expr.FunctionCall
                  |
                  +--net.sf.saxon.functions.SystemFunction
                        |
                        +--net.sf.saxon.functions.Id

All Implemented Interfaces:
  Container, Expression, InstructionInfoProvider, MappingFunction, java.io.Serializable, javax.xml.transform.SourceLocator

public class Id
extends SystemFunction
implements MappingFunction

The XPath id() function XPath 2.0 version: accepts any sequence as the first parameter; each item in the sequence is taken as an IDREFS value, that is, a space-separated list of ID values. Also accepts an optional second argument to identify the target document, this defaults to the context node.

See Also:
  Serialized Form

Field Summary

Fields inherited from class net.sf.saxon.functions.SystemFunction
`operation`

Fields inherited from class net.sf.saxon.expr.FunctionCall
`argument`

Fields inherited from class net.sf.saxon.expr.ComputedExpression
`locationId, staticProperties`

Fields inherited from interface net.sf.saxon.expr.Expression
`EVALUATE_METHOD, ITERATE_METHOD, PROCESS_METHOD`

Constructor Summary
`Id()`

Method Summary
`void` `checkArguments(StaticContext env)` Static analysis: prevent sorting of the argument
`int` `computeSpecialProperties()` Get the static properties of this expression (other than its type).
`SequenceIterator` `iterate(XPathContext context)` Evaluate the function to return an iteration of selected nodes.
`java.lang.Object` `map(Item item, XPathContext c, java.lang.Object info)` Evaluate the function for a single string value (implements the MappingFunction interface)
`Expression` `preEvaluate(StaticContext env)` preEvaluate: this method suppresses compile-time evaluation by doing nothing
`Expression` `simplify(StaticContext env)` Simplify: add a second implicit argument, the context document

Methods inherited from class net.sf.saxon.functions.SystemFunction
`addContextDocumentArgument, computeCardinality, display, getDetails, getItemType, getRequiredType, main, makeSystemFunction, setDetails, useContextItemAsDefault`

Methods inherited from class net.sf.saxon.expr.FunctionCall
`analyze, checkArgumentCount, getDisplayName, getFunctionNameCode, getNumberOfArguments, iterateSubExpressions, promote, setArguments, setFunctionNameCode, simplifyArguments`

Methods inherited from class net.sf.saxon.expr.ComputedExpression

`adoptChildExpression, computeDependencies, computeStaticProperties, dynamicError, dynamicError, effectiveBooleanValue, evaluateAsString, evaluateItem, getCardinality, getColumnNumber, getConstructType, getDependencies, getExecutable, getImplementationMethod, getInstructionInfo, getIntrinsicDependencies, getLineNumber, getLocationId, getParentExpression, getPublicId, getSpecialProperties, getSystemId, markTailFunctionCalls, process, resetStaticProperties, setLocationId, setParentExpression, typeError`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Id

    public Id()

Method Detail

### simplify

    public Expression simplify(StaticContext env)
                        throws XPathException

  Simplify: add a second implicit argument, the context document

  Specified by:
    `simplify` in interface `Expression`
  Overrides:
    `simplify` in class `FunctionCall`
  Returns:
    the simplified expression
  Throws:
    `XPathException` - if an error is discovered during expression rewriting

### checkArguments

    public void checkArguments(StaticContext env)
                        throws XPathException

  Static analysis: prevent sorting of the argument

  Overrides:
    `checkArguments` in class `SystemFunction`
    `XPathException`

### preEvaluate

    public Expression preEvaluate(StaticContext env)

  preEvaluate: this method suppresses compile-time evaluation by doing nothing

  Overrides:
    `preEvaluate` in class `FunctionCall`

### computeSpecialProperties

    public int computeSpecialProperties()

  Get the static properties of this expression (other than its type). The result is bit-signficant. These properties are used for optimizations. In general, if property bit is set, it is true, but if it is unset, the value is unknown.

  Overrides:
    `computeSpecialProperties` in class `ComputedExpression`

### iterate

    public SequenceIterator iterate(XPathContext context)
                             throws XPathException

  Evaluate the function to return an iteration of selected nodes.

  Specified by:
    `iterate` in interface `Expression`
  Overrides:
    `iterate` in class `ComputedExpression`
  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

### map

    public java.lang.Object map(Item item,
                                XPathContext c,
                                java.lang.Object info)
                         throws XPathException

  Evaluate the function for a single string value (implements the MappingFunction interface)

  Specified by:
    `map` in interface `MappingFunction`
  Parameters:
    `item` - The item to be mapped. If context is supplied, this must be the same as context.currentItem().
    `c` - The processing context. This is supplied only for mapping constructs that set the context node, position, and size. Otherwise it is null.
    `info` - Arbitrary information supplied by the creator of the MappingIterator. It must be read-only and immutable for the duration of the iteration.
  Returns:
    either (a) a SequenceIterator over the sequence of items that the supplied input item maps to, or (b) an Item if it maps to a single item, or (c) null if it maps to an empty sequence.
    `XPathException`