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 Type| Name | Type | Description |
$arg |
xs:string? |
the string (or node) to test |
| return value |
xs:boolean |
XQuery Function Declaration| See XSLT definition. | | XQuery Syntax for July 2004 - January 2007 (1.0): |
|---|
declare namespace functx = "http://www.functx.com";
declare function functx:all-whitespace
( $arg as xs:string? ) as xs:boolean {
normalize-space($arg) = ''
} ; | | XQuery Syntax for May 2003: |
|---|
declare namespace functx = "http://www.functx.com"
define function all-whitespace
( $arg as xs:string? ) as xs:boolean {
fn: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 Also| fn: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 |
|