Jeff Lynch [MVP]

Sponsors

The Lounge

Advertisement

Images in this post missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at imagehelp@codebetter.com
BizTalk Server 2004 - Logical Message Splitting Part 2a

In my last post I introduced the concept of a “Logical Splitter” pattern in which I needed to split an inbound XML document into multiple outbound documents where the number of outbound documents and the content of each document was determined by one of the fields in the inbound document. To help simplify the development of this solution, I broke the problem down into two separate but related programming issues. This post explains how I accomplished the first and my next post will explain how I accomplished the second.

  • The first is how to write a map that reorganizes one document into a structure that could be “debatched” using standard BTS2004 debatching techniques.
  • The second is how to write an orchestration to implement this (logical splitting) debatching.

Using External XSLT in the BizTalk Mapper

Besides using functoids to create your maps, the BizTalk Mapper tool also allows you to use external XSLT by setting the “Custom XSLT Path” property as shown in Figure 1 below. This allows you to use XSLT that may not be possible to create using the standard functoids or the scripting functoid.


Figure 1: Setting the Custom XSLT Path property

I’ve got to admit in the past few years I hadn’t run into a situation that required me to use write any XSLT and frankly, my skills are severely lacking in this area. So I did what any resourceful developer would do, I asked for HELP! (Please note, this is not the same as asking for directions which of course, I would never do) The nice thing is, the XML/XSLT/XPATH user community is full of great blogs and really helpful folks. There are also some very good tools available on the market such as Altova’s XMLSpy and Progress Software’s Stylus Studio. As always, the folks in the microsoft.public.xml and microsoft.public.biztalk.general pitched in to help also.


Figure 2: The Inbound Schema


Figure 3: The Outbound Schema


Figure 4: XSLT Grouping

What we (I really can’t take much credit for this) came up with is the XSLT shown in Figure 2 above. The “key” (no pun intended) is the use of the XSLT key element and key() function along with the XSLT generate-id() function. These allow you to group XML elements based upon a key value in your document, in my case the “RequestedDate” field.

Take Aways:

  1. Some things can’t be done using the BizTalk Mapper tool alone. That doesn’t mean they can’t be done, you just need to think outside the (BizTalk) box sometimes.
  2. The programmer/developer/user community is an incredible resource that didn’t exist a few years ago. Don’t be shy about asking questions and seeking help. You’ll be surprised at how much you can learn!

Special thanks to Jon Flanders at DevelopMentor for help in providing a work-around for a little BizTalk compilation bug related to using external XSLT stylesheets. More about this issue in a future post!


Posted 03-06-2005 5:50 PM by Jeff Lynch

[Advertisement]

Comments

on 04-12-2005 6:09 AM
Biztalk 2004 - XSLT, can the mapper do this? | keyongtech wrote Biztalk 2004 - XSLT, can the mapper do this? | keyongtech
on 01-21-2009 9:48 PM

Pingback from  Biztalk 2004 - XSLT, can the mapper do this? | keyongtech

Add a Comment

(required)  
(optional)
(required)  
Remember Me?