Example data in Transformation language (TML)
This example shows the map command, where a single field in the input is being mapped to a single field in the output:
<transformation> <map> <target>FredsMart/PurchaseOrder/OrderRef</target> <source>SSC/Payload/SalesOrder/OrderNum</source> </map> </transformation>
Any part of the data contained in the source, that is not mapped to a target, will not be output. Each field must be specifically mapped. Given the input data:
<SSC> <Payload> <SalesOrder> <OrderNum>123456</OrderNum> <Amount>12.34</Amount> </SalesOrder> </Payload> </SSC>
the TML would generate this output:
<FredsMart> <PurchaseOrder>123456</PurchaseOrder> </FredsMart>
When TML processes each command, the targets are 'spliced' together to create an overall document structure. The order in which the parameter information is given is not important, that is, the target can be defined before the source, or vice versa. Additionally, each field is written to the output in the order in which it is defined. Thus we can modify the TML to include a mapping for the Amount field in the sample data, outputting it before the order number field:
<transformation> <map> <source>SSC/Payload/SalesOrder/Amount</source> <target>FredsMart/PurchaseOrder/TotalAmount</target> </map> <map> <target>FredsMart/PurchaseOrder/OrderRef</target> <source>SSC/Payload/SalesOrder/OrderNum</source> </map> </transformation>
The output from this TML is:
<FresMart> <PurchaseOrder> <TotalAmount>12.34</TotalAmount> <OrderRef>123456</OrderRef> </PurchaseOrder> </FredsMart>
TML also supports multiple source fields for a single target field. In this case, each source is written to the target in the order it is provided in the TML. The values are appended as illustrated in this example:
<transformation> <map> <target>FredsMart/PurchaseOrder/OrderRef</target> <source>SSC/Payload/SalesOrder/OrderNum</source> <source>SSC/Payload/SalesOrder/Amount</source> </map> <transformation>
The output from the TML is:
<FredsMart> <PurchaseOrder> <OrderRef>123456</OrderRef> </PurchaseOrder> </FredsMart>