Applying recursion in Biztalk maps using XSLT

I had this mapping problem posted in 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:

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


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

tanks very much.... :)