chooseAdded by IBM on October 10, 2012 | Version 1 (Original)
|Given two nodesets, this function returns one of them (that is, it chooses between them) based on the results of an XPath expression.
Table 1. choose parameter
choose(boolean, nodeset1, nodeset2)
|boolean||XPath||An XPath expression that results in a Boolean value. On true, nodeset1 is used; on false, nodeset2 is used.|
|nodeset1||XPath||An XPath expression that evaluates to a nodeset.|
|nodeset2||XPath||An XPath expression that evaluates to a nodeset.|
Example The following popup presents a list of either states or provinces, depending on whether the user indicates they are from the US or Canada. In this case, a full list of the states and provinces are included in the data model. The user selects US or Canada from a radiogroup. The popup then uses the choose function to select the right group of nodes from the data model: if the user selected the US (the US data element is true), the popup uses states; if not, the popup uses provinces.
<xforms:select1 ref="stateProvince" appearance="full">
<xforms:label>Select your State/Province:</xforms:label>