Log out?

Exercise 5.1 – A Simple Mapping

Purpose:

To practice building a simple XSLT mapping in the Data Mapper.



Steps:

  1. Create a Route
    1. From the eiConsole File Management screen, select the “Add Route” button.
    2. In the dialog that appears, enter the name “A Simple Mapping” and select “OK”.
    3. The Route should now appear in the table on the screen. Double click it to open it.


  2. Document Source System
    1. Select the “Source System” stage in the “Route Editing Grid”. The configuration panel will appear at the bottom.
    2. Change the “System Name” to “Person XML File”
    3. Select the “Choose Source Icon” button, and scroll down to select one of the XML icons


  3. Configure the Listener
    1. Select the “Listener” stage in the “Route Editing Grid”. The configuration panel will appear at the bottom.
    2. Select “Directory / File” from the “Listener Type” selection box. Optionally, click the “…” button to open the Module Search Dialog, which provides a faster way to find the module you’re looking for.
    3. Assign a polling directory, using the “…” button to open the file chooser. The polling directory should NOT be the directory with all the sample files, since files will be moved/deleted by the listening process.


  4. Add Source Format and Open Data Mapper
    1. Select the “Source Transform” stage in the “Route Editing Grid”. The configuration panel will appear at the bottom.
    2. Click the “Add Format” button. In the dialog that appears, name the format “Person to Robot”, and click “OK”. The transformation configuration panel will appear below.
    3. On the right hand side, in the XSLT “To XML” configuration panel, uncheck the “Use Direct Relay” button. The options in that panel will now be enabled.
    4. Click the “New” button beneath the checkbox to open the “Data Mapper”.


  5. Load Source and Target Formats
    1. In the Data Mapper, make sure the tab at the very bottom of the screen that says “Mapping” is selected.
    2. There are three panels on the screen. The left hand panel is for the source format, the right hand panel is for the target format, and the center panel is for the mapping.
    3. Above the source format panel to the left is a row of buttons. Select the leftmost button from that row to open up the “Select Format” dialog.
    4. Select “XML” from the “Format Reader” selection box. Optionally, click the “…” button to open the Module Search Dialog, which provides a faster way to find the module you’re looking for.
    5. In the configuration panel that appears, select the “Add” button. In the File Chooser, navigate to the samples directory and select the file called “person.xml”. Once it is selected, click “Read Format”.
    6. The left hand panel will now be populated with a blue-colored tree that represents the source format.
    7. Above the target format panel to the right, select the leftmost button from that row to re-open the “Select Format” dialog. Choose the “XML” option again from the “Format Reader” selection box.
    8. The previously selected file might still appear there. If it does, select it, and then click the “Remove” button to remove it.
    9. Click the “Add” button, and use the File Chooser to navigate to the samples directory and select the file called “robot.xml”. Once it is selected, click “Read Format”.
    10. The right hand panel will now be populated with a green-colored tree that represents the target format.


  6. Perform Simple Mapping
    1. Select the “Person” Node that is the root of the tree in the source panel to the left. Drag it onto the center panel, and drop it on the “stylesheet” node that’s already there.
    2. Select the “Robot” node that is the root of the tree in the target panel to the right. Drag it onto the center panel, and drop it on the “Person” node that was just dropped there. This completes the implicit default Template for the XSLT stylesheet.
    3. Select all of the Nodes that are children of the “Robot” node in the target format panel, and drag them onto the center panel and drop them onto the “Robot” node.
    4. Click the “+” button next to the “Title”, “Vehicle”, and “Location” nodes in the target format panel to expand them to show their child nodes.
    5. Select all the child nodes beneath “Title” in the target format panel, and drag them onto the center panel and drop them onto the “Title” node there. Repeat this with the children of “Vehicle” and “Location”.
    6. Now that the whole target format has been configured in the center panel, it’s time to map the source format to it. Map the nodes in the following way:
      1. Source: Name/First -> Target: Title/One
      2. Source: Name/Middle -> Target: Title/Two
      3. Source: Name/Last -> Target: Title/Three
      4. Source: Gender -> Target: Type
      5. Source: SSN -> Target: ID
      6. Source: BirthDate -> Target: CreationDate
      7. Source: Occupation -> Target: Function
      8. Source: Vehicle/Make -> Target: Vehicle/Make
      9. Source: Vehicle/Model -> Target: Vehicle/Model
      10. Source: Vehicle/Year -> Target: Vehicle/Year
      11. Source: Address/Line1 -> Target: Address/Line1
      12. Source: Address/City -> Target: Address/City
      13. Source: Address/State -> Target: Address/State
      14. Source: Address/Zip -> Target: Address/Zip
    7. Now that the mapping is complete, select the button with a floppy disk icon from the top toolbar to save changes. When prompted for a name, use the default, “transform”.
    8. Click the “X” button in the top right corner to close the “Data Mapper” and return to the “Route Editing Grid”.


  7. Configure the Transport
    1. Select the “Transport” stage in the “Route Editing Grid”. The configuration panel will appear at the bottom.
    2. Select “Directory / File” from the “Transport Type” selection box. Optionally, click the “…” button to open the Module Search Dialog, which provides a faster way to find the module you’re looking for.
    3. Select the “Target Directory”, using the “…” button to open the file chooser.
    4. Set “robot-output” as the “Target File Name”.
    5. Set “xml” as the “Target File Extension”.


  8. Document the Target System
    1. Select the “Target System” stage in the “Route Editing Grid”. The configuration panel will appear at the bottom.
    2. Change the “System Name” to “Robot XML File”
    3. Select the “Choose Target Icon” button, and scroll down to select one of the XML icons


  9. Prepare to Test
    1. In the menu bar at the top, select “Route” -> “Testing Mode”. Make sure the changes to the Route are saved.
    2. Copy the file called “Person.xml” from the “Samples” directory provided into the directory chosen as the polling directory.


  10. Perform the Test
    1. At the top of the “Testing Mode” screen, select the “Execute Test” button.
    2. If the “Route” was configured successfully, all the Stages should light up with green checkmarks.
    3. In the OS File Explorer, open the directory selected as the “Target Directory”. The file “robot-output.xml” should be there, with the transformed contents produced by the XSLT.


  11. Output Files
    1. Compare the results from the exercise with the following example output files to see if they are correct.
      1. robot-output.xml


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

Thanks!

Our editors are notified.

Close