This article will provide you with common mapper problems and solutions, i.e., some BizTalk Mapper Patterns specifying best practices and some of the best ways to address some of your needs within the context of message transformation and also to enhance your skills when using the BizTalk Server Mapper.
One of the more challenging things to do in BizTalk Mapper is to make grouping values operations, i.e., getting a distinct list of values from a set of nodes/elements and do grouping operations over that list of values. For accomplish this we need to use custom XSLT and there is no simple syntax to write this type of XPath query in XSL 1.0 (however this is very easy to do in XSL 2.0).
The preceding-sibling axis contains all the preceding siblings of the context node; if the context node is an attribute node or namespace node, the preceding-sibling axis is empty.
The trouble with this method is that it involves two XPaths that take a lot of processing for big XML sources. Searching through all the preceding siblings with the 'preceding-siblings' axis takes a long time if you're near the end of the records. Similarly, getting all the elements with a certain values involves looking at every single element each time. This makes it very inefficient.
The Muenchian Method is a method developed by Steve Muench for performing the previous functions in a more efficient way using keys. Keys work by assigning a key value to a node and giving you easy access to that node through the key value. If there are lots of nodes that have the same key value, then all those nodes are retrieved when you use that key value. Effectively this means that if you want to group a set of nodes according to a particular property of the node, then you can use keys to group them together.
<xsl:for-each select="Order[count(. | key('groups',OrderId)[1]) = 1]">
The previous two options are related with group operations associated with the same message, but if we want to combine values from different messages into the same output message. For example: we have a message with user information and another message that have addresses, and each user can have multiple addresses, we want to combine data from two different messages and we want to group all user and addresses information into one single message.
In complex maps is usual to have scripting functoid with custom inline XSLT, and sometimes is useful to call custom .Net components directly from XSLT. There are two cases in which you will need to build your own custom extension XML file and set the Custom Extension XML file to refer to it, as follows:
It is very normal for us to work with Name/Value Pair structures inside the schema, this type of problem happens with some regularity, either mapping one Hierarchical Schema to a Name Value Pair or the reverse process.
Read suggested related topics:
Steef-Jan Wiggers edited Revision 10. Comment: Minor edit
Steef-Jan Wiggers edited Revision 9. Comment: Minor edits
Carsten Siemens edited Revision 7. Comment: Fixed typos
Awesome
Thanks, I will improve this article in the future