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

  • The explosion in mobile devices and applications has generated a great deal of interest in APIs. Today's businesses are under increased pressure to make it easy to build apps, supply tools to help developers work more quickly, and deploy operational analytics so they can track users, developers, application performance, and more. Apigee Edge provides comprehensive API delivery tools and both operational and business-level analytics in an integrated platform. It is available as on-premise software or through …

  • The first phase of API management was about realizing the business value of APIs. This next wave of API management enables the hyper-connected enterprise to drive and scale their businesses as API models become more complex and sophisticated. Today, real world product launches begin with an API program and strategy in mind. This API-first approach to development will only continue to increase, driven by an increasingly interconnected web of devices, organizations, and people. To support this rapid growth, …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds