XPath/XQuery exactly-one function

Summary

Returns $arg if it contains exactly one item. Otherwise, raises an error.

Signature

fn:exactly-one(
$arg as item()*
) as item()

Properties

This function is deterministic, context-independent, and focus-independent.

Rules

Except in error cases, the function returns $arg unchanged.

Error Conditions

A dynamic error is raised if $arg is an empty sequence or a sequence containing more than one item.