Note: This example illustrates the transformation process used in general XML to XML transformation (transformation is not limited to StoryTeller).In this example the data source contains a <message> element containing a structure of elements representing employee data. The expected output should only contain the employee data, and this employee data should be copied from the source data without any changes.
<data>
<message>
<employee>
<name>John Smelter</name>
<department>Forestry Department</department>
<university>Education University</university>
<address>
<street>Witham Hall</street>
<number>100</number>
<city>London</city>
<zipcode>1GH 423</zipcode>
</address>
</employee>
<employee>
<name>John Smith</name>
<department>Foreign Department</department>
<university>Foreign University</university>
<address>
<street>Williams Hall</street>
<number>111</number>
<city>Washington DC</city>
<zipcode>20001-111</zipcode>
</address>
</employee>
</message>
</data>
<data>
<employee>
<name>John Smelter</name>
<department>Forestry Department</department>
<university>Education University</university>
<address>
<street>Witham Hall</street>
<number>100</number>
<city>London</city>
<zipcode>1GH 423</zipcode>
</address>
</employee>
<employee>
<name>John Smith</name>
<department>Foreign Department</department>
<university>Foreign University</university>
<address>
<street>Williams Hall</street>
<number>111</number>
<city>Washington DC</city>
<zipcode>20001-111</zipcode>
</address>
</employee>
</data>
<data>
<employee>
<name>?</name>
<department>?</department>
<university>?</university>
<address>
<street>?</street>
<number>?</number>
<city>?</city>
<zipcode>?</zipcode>
</address>
</employee>
</data>
<tdt:transformation>
<tdt:rule path="/data/employee">
<tdt:value key=".">/data/message/employee</tdt:value>
<tdt:value key="recurse">.</tdt:value>
</tdt:rule>
</tdt:transformation>
<tdt:transformation>
<tdt:rule path="/data/employee">
<tdt:value key=".">/data/message/employee</tdt:value>
</tdt:rule>
<tdt:rule path="/data/employee/address">
<tdt:value key=".">address</tdt:value>
</tdt:rule>
<tdt:rule path="/data/employee/address/city">
<tdt:value key=".">city</tdt:value>
<tdt:value key="text()">text()</tdt:value>
</tdt:rule>
<tdt:rule path="/data/employee/address/number">
<tdt:value key=".">number</tdt:value>
<tdt:value key="text()">text()</tdt:value>
</tdt:rule>
...
<tdt:rule path="/data/employee/department">
<tdt:value key=".">department</tdt:value>
<tdt:value key="text()">text()</tdt:value>
</tdt:rule>
<tdt:rule path="/data/employee/name">
<tdt:value key=".">name</tdt:value>
<tdt:value key="text()">text()</tdt:value>
</tdt:rule>
<tdt:rule path="/data/employee/university">
<tdt:value key=".">university</tdt:value>
<tdt:value key="text()">text()</tdt:value>
</tdt:rule>
</tdt:transformation>
| OpenText StreamServe 5.6.2 | Updated: 2018-01-26 |