Day 3 in my RosettaNet implementation nightmare and I still can’t see the end of the road!

As you may or may not know, the American Petroleum Institute (API) has it’s own set of XML schemas and transport standards know as the Petroleum Industry Data Exchange or PIDX for short. This is the actual “standard” that my current RosettaNet project is really all about. The interesting about these schemas is the fact that they use their own unique namespace and prefix as shown below:

xmlns:pidx=http://www.api.org/pidXML/1.0

Since the BizTalk Mapper tool always generates XML document with the “ns0″ prefix and there is no property you can set to change this, you’ll need to use a little “XSLT slight-of-hand” to get this to work.

Step 1: Create your BizTalk Map as you normally would using the mapper tool.

Step 2: Validate your map and open the xslt generated by BizTalk Server 2006 in your favorite text editor. This file can usually be found in the “\temp\_mapdata” folder.

Step 3: Replace all instances of the namespace prefix “ns0″ with the prefix you require (which in this case is “pidx”) as shown below.

Step 4: Save the result as an .xslt file and include it (or add it) into your BizTalk project.

Step 5: Create a new map using the same source and destination schemas you used in Step 1 but use the external xslt you generated by setting the “Custom XSLT Path” property on your new map.

The results are shown in the figure below. Viola! The “ns0″ namespace prefix has been replaced by the desired “pidx” prefix.

Click below for more information about using external xslt in your maps.

Custom XSLT in BizTalk Maps

Take Away: There is always more than one way to skin a cat! In BTS2006 it may not be obvious how to do something a little unusual.