XPath/XQuery exists function

Summary

Returns true if the argument is a non-empty sequence.

Signature

fn:exists(
$arg as item()*
) as xs:boolean

Properties

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

Rules

If the value of $arg is a non-empty sequence, the function returns true; otherwise, the function returns false.

Examples

The expression fn:exists(fn:remove(("hello"), 1)) returns false().

The expression fn:exists(fn:remove(("hello", "world"), 1)) returns true().

The expression fn:exists([]) returns true().

The expression fn:exists(map{}) returns true().

The expression fn:exists("") returns true().

Assuming $in is an element with no children:

let $break :=
return fn:exists($break)

The result is true().