Description
The functx:all-whitespace function tests whether a string (or node that is atomized) is all whitespace or empty. If $arg is the empty sequence, it returns true.
Arguments and Return TypeName | Type | Description |
$arg |
xs:string? |
the string (or node) to test |
return value |
xs:boolean |
XQuery Function DeclarationSee XSLT definition. | declare namespace functx = "http://www.functx.com";
declare function functx:all-whitespace
( $arg as xs:string? ) as xs:boolean {
normalize-space($arg) = ''
} ; |
Exampleslet $in-xml := | <in-xml>
<a> </a>
<b>x </b>
<c> <x>x</x> </c>
</in-xml> | return |
XQuery Example | Results |
---|
functx:all-whitespace(' ') |
true |
functx:all-whitespace(' x ') |
false |
functx:all-whitespace($in-xml/a) |
true |
functx:all-whitespace($in-xml/b) |
false |
functx:all-whitespace($in-xml/c) |
false |
functx:all-whitespace($in-xml/c/text()[1]) |
true |
See Alsofn:empty | Whether a value is the empty sequence | functx:if-empty | The first argument if it is not blank, otherwise the second argument | functx:if-absent | The first argument if it is not empty, otherwise the second argument |
History |
Recommended Reading:
|