Skip to main content

Example of Transforming an XML formatted EDIFACT message to another XML format

EDIFACT

Ossi Galkin avatar
Written by Ossi Galkin
Updated over a year ago

Transforming an XML formatted EDIFACT message to another XML format

Usually the most feasible way to transform XML data to another XML structure or to plain text is to do an XSLT transformation. If you need to learn XSLT, you can start for example with the W3 Schools XSLT Tutorial.

In Frends, there are couple of XSLT Tasks and you need to select a Task that supports your process' Target Framework. In this example the Target Framework is NET 6.0 and we need to use the XSLT Transform Task.

Using the XSLT Transform task is very simple. You just pass the source XML to the Task with the Xml parameter. Usually the source XML is dynamically passed from the previous Task, in this example from the "Convert EDIFACT to XML".

The XSLT stylesheet containing XSLT instructions on how to transform the source XML is usually given as static content like in this example. If needed, before the XSLT transformation you can dynamically choose which XSLT stylesheet you wish to use and pass the XSLT content dynamically to the XSLT Transfom Task.
​
It is also possible to pass parameters to the transformation. For example, if the PaymentMeansCoded value should be easy to change without change to the XSLT, you could create an Environment Variable holding the PaymentsMeansCoded value and pass the value for the XSLT Transform Task as an XSLT parameter.

On runtime, the XSLT Transform result looks like this:
​

In this example the XSLT stylesheet produces the same result structure as the earlier JSON mapping example, but just in XML format.

Did this answer your question?