Ben Runchey’s Integration Dev Blog

a.k.a Ben’s spot to put stuff he does not want to forget

Finding out the mapper can do what I want it to do

This is a follow up post to my previous post talking about how I used some XSLT with an interim schema to get some mapping done.  In my travels around the internet since then I have found a post from Jeff Lynch about how to use the mapper to map “Small Loops“.  Well this was exactly what I was trying to get done in my previous post.  Simply put the looping functoid can get done what I need.  No more interim schema!

 here is the new and improved map

Notice how I linked the PONum, ShippingDate attributes to the Looping functoid seperately from the Item element.  Once I slowed down long enough to think about what the XSLT this would generate it made sense.  Each element or attribute plugged into the left side of the Looping functoid will have it’s own loop created for it.  That is the key here.   I have also updated the source code for this guy.

 I have to say, I like this solution much better!


February 19, 2008 Posted by | BizTalk | | 1 Comment

Some XSLT for when you just can’t get the mapper to do what you want it to do

Update – Please see my subequent post titled “Finding out the mapper can do what I want it to do” which makes this “hack” not necessary any longer 

Recently I have been spending some (maybe too much) time on the msdn forums to see if I can help out anyone that is having a problem with BizTalk.  I figure since most of my knowledge comes from reading blog posts, I need to do something that gives back to the world. 

So on friday a post showed up about needing to map from one format with data in a non repeating header and moving it to a repeating element in a destination document.  You can read actual post here.  An example of the source and destination would be as follows

The source schema looks like:


 And our destination schema looks like


So as you can see we need to take the PONum and ShippingDate attributes from the Header element of the source document and put them into two different MainLoop elements in our destination document.  Then take the repeating Item elements from the source and fill out the remaining MainLoop elements in the destination document. 

Getting the PONum and ShippingDate out proved to be a bit more challenging than I had orignally thought.   I did not want to write just straight XSLT and by pass the mapper.  That is always an option, but then I am not really using the tools available.    What I decided to do was use inline XSLT in a scripting functoid to copy the Source\Header\PONum and ShippingDate fields to the MainLoop.  So I came up first with a map that looked like this


But the Xml was not what I wanted… (not even close!)


So when looking at the xslt the map was creating I realized that  getting a MainLoop element for both my PONum and ShippingDate field would require me to have an “empty” spot in my destination schema that I could push the XSLT from my two scripting functoids into.  So I created a temporary destination schema that contained a “PlaceHolder” for me to overwrite.


Now my map looks like this…


Which produces the correct output…


Now I know, if this is a huge document, or I am doing lots of these throughout the day and performance is a very big consideration the straight XSLT approach would be more performant, but until I need to have the speed, I will take the maintainability.  You can download the project that demonstrates this here

 Mape1082 I hope this helps you somehow. 


February 19, 2008 Posted by | BizTalk | 1 Comment