If you want to be able to refer to more than a single XML file, then the other files should be imported as Named or Dynamic XML files. Below an example is used to illustrate the possibilities.
The first XML file (Invoice XML) is the primary file, but in this case we want to refer to a list of the employees of the company to include the name of our contact person in the final output (That information is not found in the invoice - only an employee number). The image below shows the import of the secondary (fixed) XML file:
The secondary file, ContactInformation.xml file looks like this:
Inside the invoice XML file we have a reference to the ID above - as ContactID (in the bottom):
Now we can define an XML cursor to point to the named XML file by clicking this icon:
Next we retrieve the ContactID from the Invoice XML file into variable, ID:
And finally we can do a lookup in the ContactInformation.xml file in this way to print the name of the contact person:
There are three things to notice above:
1) The lookup in the ContactInformation.xml file is done by use of variable, ID which is referenced via {@ID} - this is how you refer to a variable in Xpath.
2) The expression /Root/contact[ID={@ID}]/Name returns the value of the Name node, for which the ID is the same as the variable, ID.
3) The cursor name is ContactID_cursor. In this way we are referring to the second, named xml file.