fn:zero-or-one

Returns $arg if it contains zero or one items. Otherwise, raises an error.

Signature

fn:zero-or-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 [ERRFORG0003] if $arg contains more than one item.