BizTalk Mapping with Multiple Outputs Gotcha
This gotcha was something that caused me a fair bit of wasted
time the other day. I was building a map with two destination schemas.
Since the map had some complex looping and grouping requirements I
decided to build the map using a custom XSLT script. (Nowadays I build
almost all my maps using XSLT but that’s a story for another time.) The
map ran perfectly using the Visual Studio map testing tool but when it
was executing in the orchestration I kept getting the following error,
“Output of the transform does not match the expected number of output
parameters.”.
After a few hours of hair-pulling frustration and a couple of test
projects I finally figured out the source of the problem. If you use
File -> New -> File -> XSLT File in Visual Studio, by default it sets
the indent attribute on the XSLT output element. For reasons unknown
having the indent turned on causes this strange error to occur. Removing
that attribute caused the error to disappear and the map executes as
expected.
Hopefully this will save somebody else some time and hassle.