Data templates and transformations > Data transformations > Creating data transformations

Creating data transformations
A data template represents a user defined data structure, and this structure can contain static data values. In order to process dynamic values in the input data, you must create data transformation rules for the corresponding data template nodes. In StoryTeller you create rules in the Define Transformation dialog box (right-click the template node and select Edit transformation).
Defining XPath expressions
When you create a rule you can enter XPath expressions for the key values manually or use a browser to pick the appropriate values. See XPath for more information about XPath in StoryTeller.
You can browse two different trees:
Message – the data source to traverse. Use this tree to pick values from the data source, i.e. the Message.
Data template – the current data template. Use this tree if you want to use static data defined in the data template, for example choice lists. The XPath is prefixed with tdt:template() to differentiate it from XPaths related to the data source.
Transformation rules are set per template node
In order to process dynamic values in the input data, you must create data transformation rules for the corresponding data template nodes. For example, a simple value node can access a dynamic text value like this:
 
text()
/data/message/LastName
You can also specify a repeater expression on a node and then use “.” for a text value:
/data/message/LastName
text()
.
When to use a repeater depends on the circumstances (see Occurrence of template nodes).
If a template node also contains attributes, and if you want to include the attribute values in the transformation process, you can add values for the attribute nodes, for example:
 
text()
/data/message/LastName
@cat
/data/message/Category
To create a rule for a node
1
Right-click the node and select Edit transformation. The Define Transformation dialog box opens.
2
Select the Value field for a Key to include in the rule and click browse (...).
3
Browse to and select the appropriate node in the Message or Data template tree and click OK.
4
5
Note:
OpenText StreamServe 5.6.2 Updated: 2018-01-26