fn:exactly-one

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

Summary

Returns $arg if it contains exactly one item. Otherwise, raises an error [err:FORG0005].

For detailed type semantics, see Section 7.2.16 The fn:zero-or-one, fn:one-or-more, and fn:exactly-one functions[FS].

Parameters
arg The sequence of items.

Example

fn:exactly-one(("hello"))

=> "hello"

fn:exactly-one(("hello", "goodbye"))

=> XDMP-NOTONEITEM exception (because there are 2 items)
Powered by MarkLogic Server | Terms of Use | Privacy Policy