About Arbortext Styler > Creating Conditions > Conditions Walk-Through
  
Conditions Walk-Through
This example walks you through the process of creating and modifying conditions.
Example: Working with Conditions
1. In Arbortext Editor, open the transport.xml document located at Arbortext-path/samples/styler.
2. Choose File > Save As to create a local copy of transport.xml.
3. In Arbortext Editor, highlight the first occurrence of the text Cruise Ship and give it an emphasis tag.
4. Highlight the first occurrence of the text Moon Rover and give it an emphasis tag. Add a role attribute to this tag with a value of “italic”, so the element name reads emphasis role=“italic”,
5. Highlight the first occurrence of the text Satellite and give it an emphasis tag. Add a role attribute to this tag with a value of “bold”, so the element name reads emphasis role=“bold”,
6. Highlight the first occurrence of the text Train and give it an emphasis tag. Add a role attribute to this tag with a value of “underline”, so the element name reads emphasis role=“underline”.
7. Choose Styler > New Stylesheet to create a new stylesheet.
8. Select the emphasis element in the Elements list. Give the element an Inline style by selecting the style from the Style list accessed via the Edit > Style menu option.
9. With the emphasis element still selected, choose Insert > Condition.
10. In the Condition dialog box, click New Attribute Test to open the Attribute Test dialog box. Ensure that emphasis is shown as the Current Element in the Test attribute of field.
11. Choose role from the Attribute Name: list.
12. Choose Not assigned a value as the Attribute Value: setting, click OK, then click OK to save the new condition and exit the Condition dialog box. You have created a condition with which to apply formatting to the text “Cruise Ship”, whose emphasis attribute was not given a specific value in step 4.
13. Highlight the condition you just created (If attribute ”role” is not assigned any value) in the Elements list. In the Text category, set the value for the Italic field to Yes.
14. Choose Preview > Arbortext Editor.
15. In Arbortext Editor, note that the first occurrence of the text “Cruise Ship” is now italicized.
16. In Arbortext Styler, highlight the condition you just created (If attribute ”role” is not assigned any value) in the Elements list. Elect to edit the condition via the Edit > Edit Condition menu option.
17. Click New Attribute Test to open the Attribute Test dialog box. Ensure that emphasis is shown as the Current Element in the Test attribute of field.
18. Choose role from the Attribute Name: list.
19. Choose Comparison = as the Attribute Value operator, and type italic in the associated text box. Click OK to save the new test and exit the Attribute Test dialog box.
20. Select Any test is true for the value of the Condition is true if field. Note that the word “OR” is added after the first test in the Tests list. This means that the properties associated with this condition are applied to the content of an emphasis element if the role attribute on an emphasis tag either has no value or has a value of italic.
21. Click OK to save the new condition and exit the Condition dialog box.
22. Choose Preview > Arbortext Editor.
23. In Arbortext Editor, note that the phrases “Cruise Ship” and “Moon Rover” are now italicized.
24. In Arbortext Styler, select the condition you created (If attribute “role” is not assigned any value or...) in the Elements list, and then choose Edit > Edit Condition.
25. Change the value of the Condition is true if field to All tests are true. Note that the word “AND” is added after the first test in the Tests list. This means that the properties associated with this condition are applied to the content of an emphasis element only if the role attribute on an emphasis tag has both no value and a value of italic. Click OK to save the change and exit the dialog box.
26. Choose Preview > Arbortext Editor.
27. In Arbortext Editor, note that the phrases “Cruise Ship” and “Moon Rover” are no longer italicized. That is because it is not possible to have a role attribute that both has no value and is set to italic.
28. In Arbortext Styler, again select the condition you created in the Elements list, and then choose Edit > Edit Condition.
29. Change the value of the Condition is true if field back to Any test is true, and then click OK.
30. Select the emphasis element in the Elements list, and then choose Insert > Condition.
31. In the Condition dialog box, click New Attribute Test to open the Attribute Test dialog box. Ensure that emphasis is shown as the Current Element in the Test attribute of field.
32. Choose role from the Attribute Name: list.
33. Choose Comparison = as the Attribute Value, and type bold in the associated text box.
34. Click OK to save the test then click OK to save the condition and exit the Condition dialog box.
35. Highlight the condition you just created (If attribute “role” = “bold”) in the Elements list. In the Text category, set the value for the Bold field to Yes.
36. Choose Preview > Arbortext Editor.
37. In Arbortext Editor, note that “Cruise Ship” and “Moon Rover” are italicized, and “Satellite” is bold.
38. In Arbortext Styler, select the emphasis element in the Elements list and choose Insert > Condition.
39. In the Condition dialog box, click New Attribute Test to open the Attribute Test dialog box. Ensure that emphasis is shown as the Current Element in the Test attribute of field.
40. Choose role from the Attribute Name: list.
41. Choose Comparison = as the Attribute Value, and type underline in the associated text box.
42. Click OK to save the test then click OK to save the condition and exit the Condition dialog box.
43. Highlight the condition you just created (If attribute “role” = “underline”) in the Elements list. In the Text category, set the value for the Underline field to Yes.
44. Choose Preview > Arbortext Editor.
45. In Arbortext Editor, note that “Train” is now underlined.
46. Still in Arbortext Editor, click inside the first itemizedlist element. Give the element a role attribute with a value of column.
47. In Arbortext Styler, select the itemizedlist everywhere context for the itemizedlist element, and choose Insert > Condition.
48. Click New Attribute Test to open the Attribute Test dialog box. Ensure that itemizedlist is shown as the Current Element in the Test attribute of field.
49. Choose role from the Attribute Name list.
50. Choose Comparison = as the Attribute Value operator and type column in the associated text box.
51. Click OK to save the test, then click OK to save the condition and exit the Condition dialog box.
52. Highlight the condition you just created (If attribute “role” = “column”) in the Elements list and go to the Breaks category.
53. Specify Page in the Start new field.
54. Select 2 from the Columns list.
55. Choose Preview > Print (XSL-FO).
56. In the Print Preview window, note that the itemizedlist to which you added the role=”column” attribute value now starts at the top of a page. Add five new sample entries to your itemized list in Arbortext Editor, preview the document for print again and you will see that the list is arranged over two columns.