1. Problem
Your map is getting out of control, and you want to move away from using the mapper.
2. Solution
In this solution, we will move all processing in the map to an external XSLT style sheet. Take these steps to accomplish this:
Create
a new map, and specify the source and target schemas. This is the end
of the traditional mapper; it is used simply to define the source and
target schemas and house the external XSLT code
Create an XSLT document, and implement your mapping. An example of the header of an external XSLT document is shown in Figure 1.
To reference this file, click anywhere on the map surface, and look at the properties of the map. In the Custom XSLT Path property, set the path to your XSLT file (see Figure 2).
3. How It Works
When working with EDI
maps, you will invariably encounter challenges that are difficult (or
impossible) to solve with functoids. You will need to learn (or brush up
on) your XSLT skills and approach mapping issues creatively. Using
external XSLT is great for many activities, but for not all. Database
lookups, callouts to .NET assemblies, and other similar processes are
not possible. In many cases, more than a single map may be needed to
successfully map a complex EDI document.
Testing maps with external XSLT documents is quite simple. Use the
standard mapper functionality to test a map by defining the input
document and other properties (see Figure 3). Note that it is very useful to not validate the inbound and outbound documents during development—make sure and set the Validate TestMap Input and Validate TestMap Output properties to False. Once you're ready, right-click the map file in Visual Studio, and select the Test Map option.