I’ve decided to revise and repost this after seeing a question about this in the microsoft.public.biztalk.general newsgroup.


I’ve run into an interesting requirement to make sure my outbound xml file uses a specific namespace prefix. Since the BizTalk mapper always generates xml documents with the “ns0” prefix I wasn’t quite sure how to accomplish this and posted my question to the microsoft.public.biztalk.general newsgroup. It turns out to be very straight-forward to accomplish.


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


Step 2: Validate your map and open the xslt generated by BizTalk Server 2004 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 (in my case “pidx”) as shown below.



Step 4: Save this xml file 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. No default namespace prefix (“ns0”) here!




The link below explains how to use external xslt in your maps.


http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sdk/htm/ebiz_prog_map_xrkh.asp


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.


Technorati Tags: BizTalk Server, BizTalk

Share this post: Email it! | bookmark it! | digg it! | reddit!| kick it!