How to Create a Custom XSL Map for Use in BizTalk 2006

When working with BizTalk, one of the most straightforward tasks can be creating the data transformation using the BizTalk Mapper. But what about those times when your needs simply don't fit within the boundaries of the Mapper?

In previous versions, you would end up either doing multiple passes through BizTalk or perhaps using custom functionality. Now, you can take advantage of the custom map feature in BizTalk 2006.

When to Use a Custom Map

The most common item I have run into over the years where BizTalk Mapper needs help is when there is a strange parent/child or peer relationship between the source and destination document. For example, if there are two nodes that must be flattened, BizTalk Mapper will flatten the first node, but cannot properly map the second node.

For an example, look at the output of an error message from the Enterprise Library Exception Handling Application Block.

Figure 1: Sample output XML from application block

In this XML, there are two nodes that would need to be flattened using the Value Mapping (Flattening), the Exception and additional info nodes, for the destination XML as seen in Figure 2.

Figure 2: Destination XML

Writing the entire XSLT document can be a daunting task. BizTalk Mapper can help you create the XSLT. Not only is it a visual tool for mapping, but it outputs XSLT when it is compiled. To begin, create the map in BizTalk Mapper. I first created the links for the Exception node using two functoids, the equal logical functoid and then the Value Mapping (Flattening) functoid. In the equal value, I compare the property name to constant values and then send the output to the flattening functoid. The first stage of the map would look like what's shown in Figure 3.

Figure 3: BizTalk Mapper

Next, right-click on the map in the solution explorer, and then select Validate Map. In the output window, you now can select the XSLT output of the map. Take a look at the XSLT; you can see how the value mapping (flattening) functoid works.

Now, if you add in the value mapping for the additionalinfo node, you then can merge these two XSL documents or use the pattern and apply it to both. So now to create the map, simply select the source schema and the destination schema as you would when starting any map. In the properties, point the Custom XSL Path to the location of your saved file.

Figure 4: BizTalk Mapper document properties

Summary

Being able to use a custom XSL can help transform data in more ways. You also can get the full depth of the XSLT commands available to you. I also find it useful to view the XSLT when you create a map so that you can understand fully how BizTalk interprets the map you have created.

About the Author

Drew Block, MCSD, is a .NET Architect of enterprise integration and web applications. He is a Senior Manager at Crowe Chizek in Indianapolis, Indiana where he architects, designs, and manages the development of Microsoft-based solutions. You can reach Drew at ablock@crowechizek.com.



Comments

  • nILYVt VW LI sgq MOzI LD

    Posted by XuxupwvWDj on 01/27/2013 02:43am

    cheap viagra buy viagra online australia no prescription - viagra online rx

    Reply
Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Companies undertaking an IT project need to find the right balance between cost and functionality. It's important to start by determining whether to build a solution from scratch, buy an out-of-the-box solution, or a combination of both. In reality, most projects will require some system tailoring to meet business requirements. Decision-makers must understand how much software development is enough and craft a detailed implementation plan to ensure the project's success. This white paper examines the different …

  • On-demand Event Event Date: February 12, 2015 The evolution of systems engineering with the SysML modeling language has resulted in improved requirements specification, better architectural definition, and better hand-off to downstream engineering. Agile methods have proven successful in the software domain, but how can these methods be applied to systems engineering? Check out this webcast and join Bruce Powel Douglass, author of Real-Time Agility, as he discusses how agile methods have had a tremendous …

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date