Use the XSL Transformation (XSLT) mediation primitive to transform messages.
The XSL Transformation mediation primitive lets you transform messages using XSL transformations.
When you are integrating services, you often need to transform data into a format that the receiving service can process; the XSL Transformation mediation primitive lets you transform one message type into a different message type.
The XSL Transformation primitive has one input terminal (in), one output terminal (out), and a fail terminal (fail). The in terminal is wired to accept a message and the other terminals are wired to propagate a message. The input message triggers a transformation and if the transformation is successful, the out terminal propagates the modified message. If an exception occurs during the transformation, the fail terminal propagates the original message, together with any exception information contained in the failInfo element.
The XSL Transformation primitive gives you a simple mechanism for manipulating messages, using an XSLT 1.0 transformation. You can change the headers, context, or body of the SMO by mapping between the input and output message.
In order to transform messages, the XSL Transformation mediation primitive needs access to a mapping file, which you can specify using the Mapping file property. The mapping file can be either an XML mapping file or an XSL stylesheet.
When you create an XSL Transformation mediation primitive, WebSphere® Integration Developer lets you create a new XML map from the Details tab of the Properties view. Alternatively, you can browse the existing XML maps, and select a suitable one.
When you create an XML map you specify the message root, (an XPath 1.0 expression), which for mediation flows can refer to the following locations in the SMO: /, /headers, /context or /body. The message root specifies the root of the transformations, and applies to both input messages and output messages. If the message root is /, the transformation applies to the whole SMO.
If you use the XML mapping editor then, after the mapping has been created, an XSL stylesheet is generated to perform the transformation at run time. If you wire the input and output terminals of the XSL Transformation primitive before using the XML mapping editor, the input and output message types are filled in for you. For more information, see the WebSphere Integration Developer topic: Creating a new XML map.
You do not have to use the XML mapping editor. Alternatively, you can use an existing XSL stylesheet to perform your transformation. The stylesheet must exist in the mediation module project directory before you can select it. For more information, see the WebSphere Integration Developer topic: Using an existing XSL stylesheet.
In WebSphere Integration Developer version 6.1, the XSL Transformation primitive has a new XML mapping editor. XML maps that were built in a previous version must be migrated to the new format before you can edit them. For more information on migration, see the WebSphere Integration Developer topic: Migrating an XSL Transformation primitive.
If you need to connect mediation primitives whose message types are different, you can use the XSL Transformation mediation primitive to transform the message type.
You can transform messages using either the XSL Transformation primitive or the Business Object Map mediation primitive. The key difference is that the XSL Transformation primitive performs transformations in XML, using a stylesheet, whereas the Business Object Map primitive performs transformations on business objects, using Service Data Objects (SDO). If you have existing XML maps, or XSL stylesheets, you might be able to reuse them with the XSL Transformation primitive; and if you have existing business object maps you might be able to reuse them with the Business Object Map primitive. Some kinds of transformation are easier to perform in XSL, and others using a business object map.
You can browse existing XML mapping files or create a new mapping file. An XML mapping file has a generated XSL stylesheet that performs the transformation at run time.
You can browse existing XSL stylesheets, if they exist in the same project as the mediation module.
If you select /, /headers or /context as the root, you need to explicitly map all the SMO sections, using the XML mapping editor. Otherwise, you might get errors at run time. If you do not need to change any information in the headers or contexts sections of the SMO, you can use /body as the mapping starting point.
Property | Valid Values | Default |
---|---|---|
Mapping file | String | |
Root | String: An XPath expression representing the root of the transformation | /body |
Validate input | Boolean: true or false | false |
Consider the following when using the XSL Transformation mediation primitive: