Applying recursion in Biztalk maps using XSLT

I had this mapping problem posted in BiztalkGurus.com forum. Its a quite a tricky situation and I had spend some time on it. I could finally achieve it.

The original thread for the forum is at:
http://www.biztalkgurus.com/forums/t/8974.aspx



The problem is something like this. I wasn't able to put the XML text in the posting, hence had to put the the pictures. If its not clear plz mail me, I can send you the source files.


Input XML



Desired Output



Solution

Traditionally in any other language we use loops to achieve these kind of results. In XSLT we can achieve the similar result using recursive template calls. I used "Inline XSLT Call Template" in Biztalk functoid with the following xml.
I've used a custom script functoid with Inline XSLT Call template. I passed two paramters to the functoid. One is the total no. of records (param2) that I retrieved using "Record Count" functoid and the second parameter is a constant value "1". The second parameter (param3) was used to just initiate the recusive call.


Click on image to view bigger image

Click on image to view bigger image
Please mail me if you need any clarification or the source code.

1 comment:

bumbu pecel bali said...

this is good post.
and you can go here

http://bantalsilikon01.blogspot.com
http://kursusinternetmarketingmurah.blogspot.com
http://bumbupecelbali.blogspot.com


tanks very much.... :)