Log out?

eiConsole Intermediate – Transformation / Data Mapping

eiConsole v.22R1
Tutorial & Interface 

Using Identity Transforms

Overview

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 Templates”) is modified to transform a “PeopleA” XML format to the “PeopleH” XML format using an “identity transform.” Identity transforms allow users to make discrete changes to a document without remapping it in its entirety. This tutorial expands on concepts from “Data Mapping Using Templates,” 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 1
icon_sample-dataSample Data 2
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 with a Directory Listener / Transport pair. Create a new Format on the Target Transform stage called “Using Identity Transforms”:

Click “New” to open the Data Mapper. Load “PeopleA.xml” as the Source format and “PeopleH.xml” as the Target format:

Our Source and Target formats are very similar in this case. The only difference is that the Target format’s “Vehicle” element is condensed into a single tag, which is a concatenation of Make and Model. In previous tutorials, we handled such mappings by completely mapping the Source and Target formats along with all of their elements. However, there’s a concept in XSLT called an “identity transform”, which is a template that matches and copies all elements, attributes, and text recursively, as-is. Any templates added in addition to this template are the “exceptions to the rule”; their elements are handled according to those added templates.

Identity Transform

Start by dragging Custom → Uncategorized → “Identity Template” onto the “stylesheet” element:

This template’s expression matches all attributes (@), all child elements (*), and all Nodes (node()). The “|” part of the expression is a “join” between the two halves (@* and node()).

The “copy” element under the template copies the current Node, while the “apply-templates” and expression underneath recursively evaluate all child nodes of the current node.

If you were to run the transform now, you would see that the result document is identical to the source document; the identity transform creates a perfect copy.

Making Changes to the Mapping

To make changes to the mapping, we need only create templates for the elements we wish to alter. To change the handling of Vehicle, drag it from the Source onto the stylesheet:

If you were to run the transform now, you would see that the result document is identical except that the “Vehicle” elements are all missing; we’ve given “Vehicle” special handling, but have not created a new Vehicle element in its stead. Drag “Vehicle” from the Target format onto the “Vehicle” template:

Our mapping will now create a copy of the document with an empty Vehicle element. We are copying all nodes which are not Vehicle.

Concatenating Our Make and Model

Now we just need to concatenate our Make and Model. Drag the “concat” function from the tool palette onto the Vehicle element and modify the expression to combine the Make and Model (separated by a space, of course):

If we now execute our transform, we should see only the Vehicle element altered:

Identity transforms are an extremely useful tool in transformation. They allow you to make discrete, tactical modifications to a document without needlessly replicating mapping. In the eiConsole, they are most frequently used on the Target Transform stage to “tweak” a previously transformed document so that it conforms to minor changes required by a particular target system.

This concludes this tutorial. Move on to the next Tutorial “Using Keys for De-Duplication”.

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