Using External XSLT in the BizTalk Mapper

I had a client that had a lot of existing XSLT's that they wanted to use in BizTalk instead of recreating them using the BizTalk Mapper.

 

The BizTalk Mapper supports custom XSLT in two forms; the script functoid (1) and then in the Mapper itself (2) (this is the one that I was interested in).

 

1)  The script functoid operates on parts of a schema.  You can use the script functoid to write inline XSLT for any part of the schema in which the output of the functoid creates the target node and all of its appropriate substructure.  However, there can not be any other mappings to this target structure or its substructure.

 

2)       This functionality allows you to use a whole existing XSLT style sheet and use it in your BTS project.  To do this

 

a.      Add the source and destination schemas to your project

b.      Create the map (.btm file) and add the two schemas to it (but do not do any graphical mappings)

c.      Click the grid zone and on the properties window there will be a “Custom XSLT Path” property.  Click the ellipses and navigate to the file containing the XSLT.

d.      Build the project and deploy.  The Mapper will use your XSLT file to perform the mappings.

 

One thing to be aware of is that if your custom XSLT contains embedded code then the compiler gets loaded each time a map is run.  We had an old XSLT that had VB Script.  We updated the code to use VB.NET and then we loaded it into the Mapper.  When we submitted 20 messages we saw 20 instances of the VBC.EXE process load into memory.