Log out?

eiConsole Intermediate – Transformation / Data Mapping

eiConsole v.22R1
Tutorial & Interface

Using Variables


This interface and related tutorials demonstrate the use of the Data Mapper in Route configurations to transform between XML Formats. In this particular exercise, an existing Route (from “Data Mapping – Using Java Call-Outs“) is modified to transform a “PeopleA” XML format to the “PeopleG” XML format, which makes use of iteration, conditions, and variables to output “Neighbor” elements.

The tutorial covers the use of variables within the Data Mapper for storing and retrieving values within transformations. It expands on the concepts covered in “Data Mapping Using Java Call-Outs“, so users are expected to be familiar with that content.

How to Use This Example

Download the INTERFACE file and save it to your local disk.

icon_sample-dataSample Data
icon_sample-dataSample Data
icon_downloadInterface Download

Open the eiConsole, click on the File drop-down menu and select Import Working Directory/Route/Format. Highlight the name of the file to import and press the Import Selected button. The imported Interface will appear in your current Working Directory.

Next, follow the tutorial and walk through it step-by-step. You may check your work against the provided Route (Sample Data).

Create and Configure a New Route

Start by creating and configuring a new Route similar to the prior tutorial’s and create a new Format called “PeopleA XML to PeopleG XML” on the Target Transform stage:

Click “New” to open the Data Mapper and load “PeopleA.xml” for the Source and “PeopleG.xml” for the target:

Mapping Exercise

Repeat the mapping exercise from the previous tutorial or copy the resulting XSLT via the “XSLT View” tab:

Once again, a small change has been made to the Target format: the addition of the “Neighbors” element and its child “Neighbor” element. For each Person within the same State as any given Male or Female, we’ll put the concatenated First, Middle, and Last Names into a Neighbor element. Start by dragging “Neighbors” onto “Female” and “Male”:

Once the Neighbor element is added, it should look like this:

We’ll be using a “for-each” and “if” instruction to iterate over each Person once again, then conditionally place a Neighbor if the State matches. However, once we place the for-each, we’ll lose the context of the current Person. It will be replaced by the Person we’re iterating over within the second for-each.

Create a Variable

Create a variable by dragging XSLT Structures → Variable → variable onto the “Neighbors” element:

The created “variable” instruction has attributes for “name” and “select.” The “name” attribute defines the name of the variable to be referenced later. The “select” attribute is an expression that will be evaluated to be placed into the variable as its value.

We’ll set the name of our variable by double-clicking on the “name” attribute. We’ll be using “currentState” for our variable name:

Next, we need to provide a value for our variable, which in this case will be the current Person’s State value. Drag & drop State from the Source onto the “select” attribute:

Our variable definition should now look like this:

Placing onto the Neighbors Element

Next, we’ll place our for-each onto the Neighbors element:

If we drag Person from the Source panel onto the for-each select, the Mapper will assume you’re wanting the current Person. We’ll need to manually modify the value by double-clicking it and changing it to read:


Hit enter to save the value.

Next, we’ll need to drag XSLT Structures → Flow Control → if onto the “for-each”:

Dragging Onto the “for-each”

Double-click on the if “test” attribute and change it to read:

Address/State = $currentState

This will test to see if the current Person’s State matches the previously stored State. Now we’ll want to create a Neighbor element if the condition evaluates to true.

Creating a Neighbor Element

Drag Neighbor from the Target panel onto the if:

Next, repeat the concatenation from the “Data Mapping Using Functions” tutorial:

Finally, test the transformation:

If it matches the above, you are done. Congratulations. Move on to the next tutorial, Using Java Call-Outs.

This is a unique website which will require a more modern browser to work! Please upgrade today!