WebSphere Enterprise Service Bus, Version 6.2.0 Operating Systems: AIX, HP-UX, i5/OS, Linux, Solaris, Windows


XSL Transformation mediation primitive

Use the XSL Transformation (XSLT) mediation primitive to transform messages.

Introduction

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.

Details

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.

Migration

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.

Usage

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 use the XSL Transformation primitive to do the following:
  • Transform an input message type to a different output message type. For example, if the mediation flow starts with one operation but ends with another operation, and the second operation has a different argument type.
  • Alter the content of a message, without changing the message type.
  • Apply an existing XML map, or stylesheet, to transform a message.
The XSL Transformation mediation primitive can be useful if you want to:
  • Manipulate data, before or after the Database Lookup mediation primitive is invoked.
  • Copy the response from the Service Invoke mediation primitive into the shared context.
  • Create a new message body, using data in the shared context, after the Fan In mediation primitive.

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.

Properties

Mapping file
Specifies the name of the XML mapping file, or the XSL stylesheet, that the mediation primitive uses. You can choose either an XML mapping file, with an associated XSL stylesheet, or an XSL stylesheet on its own.

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 want to override the Mapping file value dynamically, at run time, you must promote the Mapping file property. (However, you must still provide a default value for the Mapping file property.) The override value must resolve to an XSL stylesheet. The stylesheet can be specified as a path to a resource in the project; for example, xslt/TransformCustomer.xsl. Alternatively, the stylesheet can be specified as a URL; for example, http://myserver.com/customerstylsheet.xsl or file://c:/customerstylesheet.xsl.
Note: The stylesheet must be available to the runtime system in order for the transformation to be successful.
Root
An XPath 1.0 expression that specifies the root of the transformation. When you create a new XML map, you can specify the following message roots: /, /headers, /context or /body. / refers to the complete SMO, /headers refers to the headers of the SMO, /context refers to the context of the SMO and /body refers to the body section of the SMO. This property is used for both the input message and the transformed message.

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.

Validate input
If true, the input message is validated at run time, before the mediation is performed.
Table 1. XSL Transformation mediation primitive properties
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

Considerations

Consider the following when using the XSL Transformation mediation primitive:


reference Reference topic

Terms of use | Feedback


Timestamp icon Last updated: 21 June 2010


http://publib.boulder.ibm.com/infocenter/dmndhelp/v6r2mx/topic//com.ibm.websphere.wesb620.doc/ref/rwesb_XSLTmediationprimitive.html
Copyright IBM Corporation 2005, 2010. All Rights Reserved.
This information center is powered by Eclipse technology (http://www.eclipse.org).