The count-non-empty() Function

Release 2.0 - ...

Syntax

  CopyCode image Copy Code
number count-non-empty(node-set)

Description

Function count-non-empty() returns the number of non-empty nodes in the argument node-set. A node is considered non-empty if it is convertible into a string with a greater-than zero length.

Example

XML CopyCode image Copy Code
<xforms:model>
   <xforms:instance xmlns:ex="http://example.org">
      <ex:root>
         <ex:value>2</ex:value>
         <ex:value/>
         <ex:value>6</ex:value>
         <ex:value></ex:value>
      </ex:root>
   </xforms:instance>
</xforms:model> 
 ...
<xforms:group>
   <xforms:output value="count-non-empty(ex:value)">
      <xforms:label>Count non-empty nodes : </xforms:label>
   </xforms:output>
</xforms:group>

The above example will return 2.

Specification

Link to the XForms specification: the count-non-empty() function.