The label() function

Release 2.0 - ...

The label() function returns the label belonging to a specific node or the label of an element with a corresponding id attribute.  

XML CopyCode image Copy Code
string sxf:label(node or id)

When the parameter represents an Xml node, the contents of the (first) label element bound to this node will be returned.

Otherwise, the parameter is interpreted as string and will be used to find an xforms element with corresponding id attribute. If found, the label contents of this element is then returned.

Example:

XML CopyCode image Copy Code
<xf:group appearance="compact">
   <strong>Error summary :</strong>
   <xf:repeat nodeset="sxf:filterbyproperty(/a:Address/*,'valid',false())">
      <xf:output value="concat(substring-before(sxf:label(node()),':'),
             ' - ', sxf:alert(node()))" />
   </xf:repeat>
</xf:group>

Within the above example, the label (and alert) extension functions are used to generate a summary of invalid nodes. The invalid nodes are determined using the filterbyproperty extension function.

Namespaces

This function is available within the Smartsite XForms namespace (http://smartsite.nl/namespaces/xforms/1.0).