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 Absolute XPath check box is unchecked) or as an absolute expression starting from the document node (if the Absolute XPath check box is checked).
|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.|
Insert Output-Based Condition
This command inserts an output based-condition at the cursor location or around the selected component. Each branch of the condition represents a single output (Authentic View, RTF, PDF, Word 2007, or HTML). To determine which branch represents which output, mouseover the branch tag or check the XPath expression of the selected branch (in the Properties sidebar, in the Condition Branch entry, click the Edit button). If the output-based condition was created at a cursor insertion point, all branches will be empty and content will have to be inserted for each branch. If the output-based condition was created around a component, each branch will contain that component. For more details about output-based conditions, see Output-Based Conditions. You can edit, move, and delete output-based conditions in the same way you would with a standard condition.
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.
© 2019 Altova GmbH