You can insert conditions anywhere in the design, in both the main template and global templates. A condition is an SPS component that is made up of one or more branches, with each branch being defined by an XPath expression. For example, consider a condition composed of two branches. The XPath expression of the first branch tests whether the value of the Location attribute of the context node is "US". The XPath expression of the second branch tests whether the value of the Location attribute is "EU". Each branch contains a template—a condition template. When a node is processed with a condition, the first branch with a test that evaluates to true is executed, that is, its condition template is processed, and the condition is exited; no further branches of that condition are evaluated. In this way, you can use different templates depending on the value of a node. In the example just cited, different templates could be used for US and EU locations.
This section consists of the following topics:
|•||Setting Up the Conditions, which describes how to create a condition and its branches.|
|•||Editing Conditions, about how to edit the XPath expressions of condition branches after they have been created.|
|•||Conditions for Specific Outputs, which shows how conditions are used to produce different output for different output formats.|
|•||Conditions and Auto-Calculations, explains usage issues when conditions and Auto-Calculations are used in combination.|
© 2019 Altova GmbH