XPath/XQuery innermost function

Summary

Returns every node within the input sequence that is not an ancestor of another member of the input sequence; the nodes are returned in document order with duplicates eliminated.

Signature

fn:innermost(
$nodes as node()*
) as node()*

Properties

This function is deterministic, context-independent, focus-independent, and special-streaming-rules.

Rules

The effect of the function call fn:innermost($nodes) is defined to be equivalent to the result of the expression:

$nodes except $nodes/ancestor::node()

That is, the function takes as input a sequence of nodes, and returns every node within the sequence that is not an ancestor of another node within the sequence; the nodes are returned in document order with duplicates eliminated.

Examples

If the source document contains nested sections represented by div elements, the expression innermost(//div) returns those div elements that do not contain further div elements.