empty

Whether a value is the empty sequence

Description

The fn:empty function checks whether sequence is empty, meaning that it contains zero items. A sequence is not considered empty just because it only contains a zero-length string, the value 0, or an element with empty content.

It is often unnecessary to call the fn:empty function because sequences are automatically converted to their effective boolean value where a boolean value is expected

Parameters

Description

arg:string()

Examples

XPath

Results

Explanation

empty( (‘a’, ‘b’, ‘c’) )

false

empty( () )

true

empty(0)

false

empty($in-xml/a)

false

empty($in-xml/b)

false

empty($in-xml/c)

false

empty($in-xml/foo)

true

Or a static error, if static typing is in effect and foo is not an allowed child.

XPath

Results

empty( (‘a’, ‘b’, ‘c’) )

false

empty( () )

true

empty(0)

false

empty($in-xml/a)

false

empty($in-xml/b)

false

empty($in-xml/c)

false

empty($in-xml/foo)

true

See Also