Data templates and transformations > Data transformations > Occurrence of template nodes

Occurrence of template nodes
A data template only represents structural information of data, i.e. the relation between parents, children and siblings. It does not say anything about the occurrence. Any template node can vary in occurrence, typically one of the following:
Mandatory – exactly one value is present.
Optional – a value may or may not be present.
Repeatable – zero to N values are present.
The data transformation rule defined for a node will affect how the corresponding data is treated in the output. The following rule examples are used to illustrate this.
Example – No repeater in rule
 
text()
/data/message/node
Example – Repeater in rule
/data/message/node
text()
.
When designing the presentation (layout) of the data it is important to know what the expected occurrence is and create the design accordingly.
Mandatory
If the expected occurrence is Mandatory you typically use a Substitution (no Repeater) in the layout. If there is a single value in the input data, both rule examples above are OK and produce the same output.
If there is no value in the input data, the transformation rule for the corresponding node will affect the output:
No repeater in rule – empty string in output.
Repeater in rule – runtime error "Received 0 values, expected 1".
Repeatable
If the expected occurrence is Repeatable the transformation rule must include a repeater (Repeater in rule), and you typically use a Repeater and a Substitution in the layout.
Optional
If the expected occurrence is Optional you can use the following combinations transformation rules and layout objects:
1
No repeater in rule and a Substitution in the layout. If there is no value in the input data, there will be an empty string in the output.
2
Repeater in rule and a Repeater/condition and Substitution in the layout. If there is no value in the input data, the entire Repeater content will disappear and the Substitution will not be evaluated.
OpenText StreamServe 5.6.2 Updated: 2018-01-26