Condition, Output-Based Condition
The Condition command enables you to insert a condition at the cursor point or around the selection. A condition consists of one or more branches, with each branch containing a specific set of processing rules. In this way, different sets of processing rules can be specified for different branches. For example, if the content of a node is the string Stop, the branch can test this, and specify that the contents of the node be colored red; a second branch can test whether the contents of the node is the string Go, and, if yes, color the contents of the node green; a third branch can specify that if the contents of the node is neither the string Stop nor the string Go, the contents of the node should be colored black.
To insert a condition, do the following:
1.Place the cursor at the desired location in the design or select the component around which the condition is to be inserted.
2.Select the menu command Insert | Condition or right-click and select the context menu command Insert | Condition.
3.In the Edit XPath Expression dialog that pops up (screenshot below), enter the XPath expression.
The context node for the expression being built is highlighted in the schema tree in the pane at extreme left. You can enter the XPath expression directly in the text box, or you can double click an item (in any of the three panes) to insert that item. Nodes inserted from the schema tree in the left-hand pane are inserted relative to the context node (if the Relative XPath check box is checked) or as an absolute expression starting from the document node (if the Relative XPath check box is unchecked).
|4.||Click OK to finish inserting the condition. The condition is created with one branch, the test for which is the XPath expression you entered.|
Editing the XPath expressions of branches
To edit the XPath expression of a branch, select the branch in Design View. Then, in the Properties sidebar, select condition branch | when. Click the Edit button for the XPath item. This pops up the Edit XPath Expression dialog (screenshot above), in which you can edit the expression. Click OK when done.
Adding branches, changing the order of branches, and deleting branches
To add new branches, change the order of branches, and delete branches, right-click the required branch and select the relevant item from the context menu.