exists
Whether an argument is the empty sequence
Description
The fn:exists function returns true if the sequence contains one or more items; it is the opposite of the fn:empty function. It is often unnecessary to call the fn:exists function because sequences are automatically converted to the effective boolean value where a boolean value is expected.
Parameters |
Description |
|---|---|
arg:string() |
the sequence to test |
Examples
XPath |
Results |
|---|---|
exists( ('a', 'b', 'c') ) |
true |
exists( '' ) |
true |
exists( () ) |
false |
exists( false() ) |
true |
In a generator
Copy the snippet below and paste it in Freemapper, under a language node inside the generators element. Each line of the pattern prints the result of one example; to see them, run mi generate <project> <language> example-exists.
[e] example-exists
[e] start
[e] match
[v] /
[e] body
[e] write-pattern
[v] examples
[e] patterns
[e] examples
[v] E01: {{ exists( ('a', 'b', 'c') ) }}
[v] E02: {{ exists( '' ) }}
[v] E03: {{ exists( () ) }}
[v] E04: {{ exists( false() ) }}