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 |
XSLT Function DeclarationSee XQuery definition. | <xsl:function name="functx:all-whitespace" as="xs:boolean"
xmlns:functx="http://www.functx.com">
<xsl:param name="arg" as="xs:string?"/>
<xsl:sequence select="
normalize-space($arg) = ''
"/>
</xsl:function>
|
Examples<xsl:variable name="in-xml" as="item()*"> | | <in-xml>
<a> </a>
<b>x </b>
<c> <x>x</x> </c>
</in-xml> |
| </xsl:variable> |
XPath 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:
|