The union() function

Release 2.0 - ...

XPath 1.0 already contains an union operator ("|"), so in many cases you don't need the union() extension function.
However, applying the union operator on nodes from multiple instances will not work (at least not in our XForms engine).

So, when you need to join nodesets from multiple instances, you should use the union() extension function.

  CopyCode image Copy Code
node-set union(node-set expression[])

It returns a node-set, which can then be used to iterate through the nodes.

Parameters:

  • node-set expression(s): comma-seperated list of one or more node-set expressions.

Example:

  CopyCode image Copy Code
sfx:union(instance('company')/employees/employee, instance('edit-employee')/employee)

This example returns a node-set containing all the employees/employee nodes from the company instance and all the employee nodes from the edit-employee instance.

Namespace

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