Integration Engine Solutions to Connect Anything to Anything

Log out?

Purpose:

To practice using conditions and predicates in XSLT in the Data Mapper.



Create a Route

    1. From the eiConsole File Management screen, select the Add Route button.
    2. In the dialog that appears, enter the name Conditions and Predicates and select OK.
    3. The Route should now appear in the table on the screen. Double-click it to open it.

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 People XML File.
    3. Select the Choose Source Icon button, and scroll down to select one of the XML icons.

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 selector. The polling directory should NOT be the directory with all the sample files, since files will be moved/deleted by the listening process.
    4. Go to the Post-Process tab and select Delete from Postprocess Operation.

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 People to Robots 5, 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.

Load Source and Target Formats

    1. Use the Open Source Format button above the Source Format panel to open the Select Format dialog. Choose XML from the Format Reader selection box.
    2. Click the Add button and in the File Selector, navigate to where the the sample files are located. Choose the file called people.xml. Click OK, and then click Read Format.
    3. Use the Open Target Format button above the Target Format panel to re-open the dialog. From the XML Format Reader, re-open the File Selector and select the file  people_by_gender.xml. Click OK, and then click Read Format.
    4. The Source and Target Format panels should now be populated.

Map the Root Nodes 

    1. Select the People 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 People 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 People node that was just dropped there. This completes the implicit default Template for the XSLT document.

Use a Predicate to Build the Males Section

    1. Drag the Males node from the right-hand Target tree panel onto the center mapping panel, and drop it onto the People node that is there.
    2. In the extensions panel, type for-each into the Filter by Pattern field. Drag the for-each node that appears on top of the Target Males node in the center mapping panel.
    3. Drag the Person node from the left-hand Source tree panel onto the center mapping panel, and drop it on the @select node that is a child of the for-each.Use a Predicate to Build the Males Section
    4. Double-click on the [@select]Person node in the center mapping panel to edit the mapping. A text field should appear on top of it.
    5. Add a predicate to the expression to test for the presence of Gender = Male. The Predicate should read: Person[Gender = ‘Male’]. Press Enter to save the changes.
    6. Drag the Name node from the right-hand Target tree panel onto the center mapping panel, and drop it on top of the for-each node.
    7. Drag the First Name node from the left-hand Source tree panel onto the center mapping panel, and drop it on top of the Target Name node.Use a Predicate to Build the Males Section

Use a Condition to Build the Females Section

    1. Drag the Females node from the right-hand Target tree panel onto the center mapping panel, and drop it onto the People node that is there.
    2. In the extensions panel, drag the for-each node down to the center mapping panel again, and drop it on the Target Females node. There should now be two for-each Nodes in the center mapping panel.
    3. Drag the Person node from the left-hand Source tree panel onto the center mapping panel, and drop it on the @select node that is a child of the for-each. This time, though, we will NOT be adding a predicate.
    4. Back in the extensions panel, type If into the Filter by Pattern field and drag the If node that appears down over the center mapping panel. Drop it on top of the second for-each node.
    5. Under If will be a node called @test. Double-click it to open its text field. Enter Gender = ‘Female’ as the test, and press Enter to save the changes.
    6. Drag the Name node from the right-hand Target tree panel onto the center mapping panel, and drop it on top of the if node.
    7. Drag the First Name node from the left-hand Source tree panel onto the center mapping panel, and drop it on top of the Target Name node.Use a Condition to Build the Females Section
    8. Now that the mapping is complete, click the Save icon in the toolbar above the tree. When prompted for a name, use the default, transform.
    9. Click the X button in the top right corner to close the Data Mapper and return to the Route Editing Grid.

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 selector.
    4. Set people-by-gender-output as the Target File Name.
    5. Set xml as the Target File Extension.

Prepare to Test

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

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 people-by-gender-output.xml should be there, with the transformed contents produced by the XSLT.

Output Files

    1. Compare the results from the exercise with the following example output files to see if they are correct.
      1. people-by-gender-output.xml

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