Mohammed Atef’s Technical blog

How BizTalk Maps Work


All BizTalk developer have used Map Editor before. But did you ask before how it is working?!! Today I would like to tell you how BizTalk Map Editor is working in this simple post.

How it is working?

BizTalk maps works from Top to Bottom by other way from Target to Source, so BizTalk mapping Target from beginning to end, then Mapping rules are constructed and executed as links are encountered on the output side and data is extracted from the source when a link is encountered in the target at the end data is pulled into the file structure based on the structure of the output schema. I think this is the best way for parsing the Map because sometimes we set some target values without using and source elements.
Also BizTalk Map is designed to generate XML output and the map graphically displayed is actually an XSLT style sheet built to write output into the specific format defined by the output schema, so you can easily generate the *.xsl file containing the map code at any point in the development of your map and look to see how the map rules are being generated.

You can generate xsl Map code by executing the Validate Map function, found by right clicking the map name in the Solution Explorer.

You can try with any BizTalk Map you have and if you have good knowledge about XML and XSLT you can also understand how Maps built?

Understand XSL Map Code

The most component used in the XSL Map are
when you examine the code XSL Map code you find many unexpected variables. The compiler creates and uses internal variables for its own use, most often to contain the output of functoids. Any time a logical operation produces output that must be consumed by another operation or placed into the target model; the compiler creates an internal variable in which the value can be stored temporarily.

<xsl:variable name="var:v1" select="Address/text()"/>
<xsl:value-of select="$var:v1"/>

Here in this example we Map the source Address element to the Target ShipAddress.

Compiler-Generated Scripts

we can see C# script for each functoid or for any custom C# script we add using the Script Node.these scripts are found in the CDATA section at the end of the map


<msxsl:script language="C#" implements-prefix="usercsharp">
public string DateCurrentDate()
DateTime dt=DateTime.Now;
Return dt.ToString("yyyy-MM-dd");

This is very simple C# method used to retun the current date.

Optional Links

If you have element name FName in the source Schema and you directly linked this element to another on called Name int the Target Schema and the two elements are optional so you will find the xsl Map code as follow

<xsl:if test="FName">
<Name><xsl:value-of select="FName/text()"/></Name>

but if this two elements(FName,Name) are mandatory you will find the following

<Name><xsl:value-of select=”FName/text()”/></Name>

Using C# code

you can see a lot of calls to C# scripts in this XSL Map.for example you can find the following code for setting the Target Schema AddedDate Element is

<xsl:variable name="var:v1" select="usercsharp:DateCurrentDate()"/>
<xsl:value-of select="$var:v1"/>

I think it is clear now that BizTalk Map Mainly use simple XSL with C# scripts.

I hope this help.


June 21, 2009 - Posted by | Biztalk | ,


  1. thanks, thats was very helpful

    Comment by Mehmet AYDIN | August 22, 2009 | Reply

  2. Thank you for commenting

    Comment by mohammedatef83 | August 23, 2009 | Reply

  3. If you would like to increase your experience just
    keep visiting this web page and be updated with the hottest
    gossip posted here.

    Comment by Ashlee | June 20, 2013 | Reply

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: