The BizTalk Server 2004 schema mapping (transformation) facilities are used to transform a document instance from one schema into a new document with a different one (it also supports 1-* and *-1 and *-* transformations). The underlying transformation engine is the XSLT transformation engine.

It is generally believed that the visual mapping tool found in BizTalk 2004 inside VS.NET 2003 produces XSLT code directly. Alas, this is incorrect. If you look at the .btm files with a text editor, you will soon see it is indeed an XML file, but one with a custom BizTalk format. What the .btm file actually does is describe the transformation in a sort of abstract way: What the source and destination schemas are, What links exists between nodes in the schemas, which functiods are used and so on.

When you actually compile your BizTalk project, one of the BizTalk tools takes the .btm file as input and produces two intermediate files out of it: The xslt transformation, and a secondary XML file containing information on extension objects used (I'll cover that in a minute).

How functoids used in your map manifest themselves in the output depends on their kind. We can basically separate them on two categories (I made up the names, their not official or anything):

  • Structure functoids: These are functoids whose functionality can be represented directly in XSLT code. These are things like the loop functoid and so on, that are simply translated into their corresponding XSLT constructs.
  • Code functoids: These are functoids that need to be "coded", and will simply pop up as inline C# (or whatever) code in the XSLT called using the msxsl:script facilities.

So, what are extension objects used for? Well, they are used to represent calls to code implemented in external assemblies. If you use the Script functoid, and reference a .NET class, then an entry in the extension object XML file will be added that specifies the full typename of said class, and then, a call to that component will be introduced in the generated XSLT as a call to an XSLT extension object (hence the name). A basic XML extension object file looks like this:


AssemblyName="full assembly name"
ClassName="The class used"
/>

So, now you have your XSLT code. How does that get represented into an assembly?

Each map in a project pop ups in the generated assembly as a .NET class derived from Microsoft.XLANGs.BaseTypes.TransformBase. Said class overrides a few methods in Transform base, the two most important of which are the getter methods for the XmlContent and XsltArgumentListContent properties. The first one returns a string containing the entire generated XSLT code (yes, it's encoded as a string literal, as opposed to a resource, go figure). The second one returns, you guessed it, a string with the contents of the extension object XML file. Two other interesting properties are SourceSchemas and TargetSchemas; you can guess what they do ;)

So this was it for a basic overview of BizTalk Server 2004 maps. Hope this helps someone!


Tomas Restrepo

Software developer located in Colombia. Sr. PFE at Microsoft.