Click here to Skip to main content
13,193,551 members (49,240 online)
Click here to Skip to main content
Add your own
alternative version


27 bookmarked
Posted 28 Feb 2006

Using Custom XSLT Transformations in BizTalk Server 2004 Mapper

, 28 Feb 2006
Rate this:
Please Sign up or sign in to vote.
This article uses the custom XSLT transformations in the BizTalk Server 2004 Mapper.


During the development of complex maps using the BizTalk Mapper tool, one encounters several situations where custom mapping would be required in order to complete a transformation. This article will explain how to perform custom XSLT transformations using the BizTalk Mapper tool.


Consider a Purchase Order (PO) request which would contain a main order request and a set of supplementary order requests. This would be similar to a Parent-Child relationship where a Parent PO would contain several Child POs for various items contained in the Parent PO.

The BizTalk Flat File Schema Solution - Input Schema


In this example, we will need to generate a baseline item (PARENT) data tag, and several subline data items (CHILD) which belong to the baseline data item. The input will contain several "POAckDetail" elements, each having several attributes.

  1. The attribute "ItemChildFlag" specifies whether the node is a "PARENT" or a "CHILD".
  2. The attribute "ParentLineNumber" specifies the parent which the "CHILD" node belongs to.
  3. The attribute "ParentLineNumber" must match with the "SellerLineNum" of the parent node.


Notice the second POAckDetail element whose "ItemChildFlag" attribute value contains "CHILD". This element's parent would be the POAckDetail element with SellerLineNum="0003".

The BizTalk Mapper


We would need to add a script functoid in order to do a custom XSLT transformation. A custom XSLT would contain a "template" tag where the XSLT mapping must be written. The input to the custom scriptoid would become a <xsl:param name="SellerLineNum" /> in the XSLT template.

The Functoid Map and the Custom XSLT Transformation Script


<xsl:template name="MyXsltConcatTemplate">
<xsl:param name="SellerLineNum" />

<xsl:for-each select="//POAckDetail/ItemCurrentInfo[@ItemChildFlag='CHILD' 
                         and @ParentLineNumber=$SellerLineNum]">



             select="../SellerLineNum" /></ns0:_380_Quantity_E4> 

             select="@UnitPrice" /></ns0:_212_Unit_Price_E20> 

             select="@BasisOfUnitPriceTypeCode" />



Line 1: The XSL template declaration statement

Line 2: The XSL parameter, this will map to the input given to the script functoid.

Line 3: The XSL for-each statement that iterates over 'CHILD' POAck elements.

Lines 4-8: Creating the XML structure as required for the output.

Lines 9-10: Closing the tags.

Validating and Testing the Map Created

Once we have finished writing the map, we need to test the map.

Step 1: In the Solution Explorer, select the map "CBO-To-ASC_X12-Map.btm", and right-click and select "Properties". Specify the properties as shown in the image below...

Map Property Pages

Step 2: In the Solution Explorer, select the map "CBO-To-ASC_X12-Map.btm", and right-click and select "Test Schema". Observe the output window and you would notice a message starting with "Component invocation succeeded". Now, click on the link which starts with the message "Test Map success for map file..."

The XML output file would look like this...


Quick Takeaways

  1. The BizTalk Mapper script functoid offers maximum flexibility during mapping, by using custom XSLT templates.


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Naveen Karamchetti
Architect AT&T Wi-Fi Services
United States United States
Naveen has done his Masters (M.S.) in Computer science, has started his career programming the mainframes and now has more than a decade of programming, development and design experience. Naveen has a sharp eye and keen observation skills. Naveen has worked for several companies and strived hard to build large scale business applications and bringing better solutions to the table.
Quite recently Naveen has built a fairly complex integration platform for a large bank. His hobbies include training, mentoring and research. Naveen spends his free time visiting National Parks nationwide.

Naveen has developed the BizTalk Control Center (BCC)

You may also be interested in...


Comments and Discussions

-- There are no messages in this forum --
Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.171018.2 | Last Updated 1 Mar 2006
Article Copyright 2006 by Naveen Karamchetti
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid