Creating a new XML map

Use the XML Mapping editor to create an XML map between the input and output message, then generate an XSL style sheet from the XML map. The XSL style sheet will be used by the XSL Transformation primitive to map message types at runtime.

Tip: Wire the input and output terminals of the XSL Transformation primitive before mapping the message types, so that they are pre-filled in the Specify Message Types wizard that launches the XML Mapping editor.

Follow these steps to create a new XML map, and then generate an XSL style sheet from it.

  1. Click the New button. The Specify Message Types wizard launches
  2. Identify the part of the message that is available to the transformation, for both the input and output messages. Select an option in the Message Root list:
    • / to transform the complete message.
    • /body to transform the message body
    • /headers to transform the message headers
    • /context to transform the message context

    Note: When you select /, /headers or /context as the root, you need to explicitly map all the message sections in the XML Mapping editor using the Match Mapping menu option. Otherwise, you may get errors at runtime. See the example below for more information.

  3. If your XSL Transformation primitive is wired, the wizard shows the input and output message types that will be mapped. If you need to specify the message types, click Browse. Click Finish to launch the XML Mapping editor
  4. Expand the message trees in the source and target sections of the mapping editor, until you reach the elements that you want to map. Click on an element in the Source section, and then click on the matching element in the target section. Right-click, and select Create Mapping. Save your changes in the XML Mapping editor
  5. In the mediation flow editor's properties view, you will now see the XML map. An associated XSL style sheet will be automatically generated from the XML map.

Example:

The picture below shows the mapping between the source and target message for the TransformToDelayed primitive in the XML Mapping editor. The root property was set to /, so the complete message is displayed in the editor. The input message operation getQuote has a parameter named request that takes a business object that has an attribute whose name is symbol. The output message operation has a parameter symbol of type String. The mapping shown is between the symbol attribute of the input message to the symbol of the output message.


Picture of TransformToDelayed primitive in the XML Mapping editor

Since the root was set to /, all the message sections in the mapping editor must be explicitly mapped. Click on the top level element (smo) of the source and target, right-click, and select Match Mapping, as shown in the picture below:

Picture of match mapping in the XML Mapping editor

For more information, see Rational® Application Developer topic Mapping between XML files

Related concepts
XML mapping tips
Related tasks
Using an existing XSL style sheet
Using an existing XML map
Migrating an XSL Transformation primitive

Feedback
(C) Copyright IBM Corporation 2005, 2006. All Rights Reserved.