BizTalk Map Editor (Mapper) is a good editor, especially in the last 2010 version of the BizTalk. But still sometimes it cannot do the tasks easily. It is time for the Xslt code, It is time to remember that the maps are executed by the Xslt engine.

Right-click the Mapper Grid (a field between the source and target schemas) and choose Properties /Custom XSLT Path. Input here a name of the file with Xslt code. Only this code will be executed, forget the picture in the Mapper, all those links and functoids.

Let’s see the real-life example.

There are two source Addresses. One is on the top level and the second is inside the Member_Address record with MaxOccurs=* .

The target address is placed inside the Locator record with MaxOccurs=*.

The requirement is to map all source address to the one target address structure.

The source Xml document looks like:

The result Xml should be like this:

Try to do this mapping with the Mapper and you will spent good amount of time and the result map would be tricky.

If we use the Xslt code, the mapping will be simple and unambiguous, like this:

Simple, elegant.