The nilled() function

Smartsite 7.4 - ...

The nilled() XPath 2.0 function returns true for an element that is nilled.

XML CopyCode image Copy Code
boolean fn:nilled(arg1)

Parameters:

  • arg1: a node reference. 

Example

XML CopyCode image Copy Code
<html xmlns="http://www.w3.org/1999/xhtml" 
 xmlns:xf="http://www.w3.org/2002/xforms" 
 xmlns:fn="http://www.w3.org/2005/xpath-functions" 
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <head>
     <title>XForms Document</title>
     <xf:model>
       <xf:instance>
         <data xmlns="">
           <entry>
             <strings>
               <string index="1">a</string>
               <string index="2">b</string>
               <string index="3" xsi:nil="false">c</string>
               <string index="4" xsi:nil="true"></string>
             </strings>
           </entry>
         </data>
       </xf:instance>
     </xf:model>
    </head>
    <body>
      <xf:group ref="entry" appearance="full" class="nilled">
        <xf:label />
        <xf:output value="fn:nilled(strings/string[@index='2'])" />
        <xf:output value="fn:nilled(strings/string[@index='3'])" />
        <xf:output value="fn:nilled(strings/string[@index='4'])" />
      </xf:group>
    </body>
</html>

The result will be:

false
false
true

Namespace

This function is available within the XPath 2.0 namespace (http://www.w3.org/2005/xpath-functions).