home contribute faq download

FunctX XSLT Functions

functx:all-whitespace

Whether a value is all whitespace or a zero-length string

Google
Webdatypic.com

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

NameTypeDescription
$arg xs:string? the string (or node) to test
return value xs:boolean

XSLT Function Declaration

See 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 ExampleResults
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:emptyWhether a value is the empty sequence
functx:if-emptyThe first argument if it is not blank, otherwise the second argument
functx:if-absentThe first argument if it is not empty, otherwise the second argument

History

Published OnLast UpdatedContributor(s)
2006-06-272007-02-26Priscilla Walmsley, Datypic, pwalmsley@datypic.com, https://www.datypic.com
Datypic XSLT Services

Recommended Reading:

XQuery