Concatenating string elements in the XML mapping editor

The XML mapping editor provides a number of XSLT functions that enable you to manipulate strings and operate on numbers. In this topic, we use an example to show how to use the concat function in the XML mapping editor.

The concat function returns the concatenation of its arguments. You can use this function to concatenate the values of two or more source elements into a target element value. Consider the following example map:
Example map in the XML mapping editor

In this example, we will concatenate the symbol and customerName elements of the source to the customerName element of the target.

  1. First, we create a mapping between the source and target elements as follows:
    1. On the source side, click symbol, hold the ctrl key and click customerName.
    2. On the target side, click customerName.
    3. Right-click and Create Mapping.
  2. Next, we apply the concat function to the mapping. Right-click again on the target customerName, and Define XSLT function.
  3. In the XSLT Functions window, choose String and click Next.
  4. Select concat from the list of functions.
  5. Add the value of the mapped source elements as input parameters to the function:
    1. Click Add. A list of possible XPaths and variables is displayed.
    2. Select /body/getQuote/inputGetQuote/symbol/text(). Click OK.
    3. Select /body/getQuote/inputGetQuote/customerName/text().
    4. Click Finish
The mapping appears in the Overview section of the editor, as seen below:
XML mapping with the concat function applied
Note:
You can also use the concat function to concatenate hardcoded strings, however the strings must be within single quotes. For example, concat('A', 'B', 'c') results in 'ABc'.

For information on all the XSLT functions available in the XML mapping editor, see Defining XSLT functions.

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