<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Roy Wilson's WebLog</title><link>http://blogs.msdn.com/roywils/default.aspx</link><description /><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Wow...this blog still exists...</title><link>http://blogs.msdn.com/roywils/archive/2007/07/04/wow-this-blog-still-exists.aspx</link><pubDate>Wed, 04 Jul 2007 15:29:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3689487</guid><dc:creator>roywils</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/roywils/comments/3689487.aspx</comments><wfw:commentRss>http://blogs.msdn.com/roywils/commentrss.aspx?PostID=3689487</wfw:commentRss><description>&lt;P&gt;I think I'd win a competition for&lt;STRONG&gt; least updated blog&lt;/STRONG&gt; - ahh the wonderful world of consulting for a living... :)&amp;nbsp;I've been doing lots of work on WS-Security implementations, WSE 3.0&amp;nbsp;+ WCF compatibility &amp;amp;&amp;nbsp;BizTalk 2006 R2 recently, so I will&amp;nbsp;post something here on this really soon and hopefully kick start a&amp;nbsp;better trend for this year!&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=3689487" width="1" height="1"&gt;</description></item><item><title>Mapping xsi:nil attributes in the Biztalk 2004 mapper</title><link>http://blogs.msdn.com/roywils/archive/2005/09/23/472748.aspx</link><pubDate>Fri, 23 Sep 2005 11:00:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:472748</guid><dc:creator>roywils</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/roywils/comments/472748.aspx</comments><wfw:commentRss>http://blogs.msdn.com/roywils/commentrss.aspx?PostID=472748</wfw:commentRss><description>&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-pagination: none; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;In the last few days, a customer asked me an interesting question about mapping &lt;FONT color=#ff0000&gt;&lt;STRONG&gt;xsi:nil&lt;/STRONG&gt;&lt;/FONT&gt; attributes in the Biztalk 2004 mapper.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;In Biztalk 2006, there are a couple of new functoids which help with mapping these attributes, but unfortunately there is no easy way to handle these conditionally in the 2004 mapper.&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;Fortunately, with some knowledge of XSLT, you can achieve the same functionality with Biztalk 2004 today.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;I've published an explanation of the problem and a quick mapper solution here and hopefully some of you may benefit from the approach.&lt;BR&gt;&lt;BR&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-pagination: none; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;U&gt;Customer Problem&lt;BR&gt;&lt;BR&gt;&lt;/U&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-pagination: none; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;The customer has a source schema which contains elements that are nillable (i.e. the nillable attribute is set on a number of elements).&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;The Biztalk 2004 mapper does not provide any means to detect the presence or absence of the xsi:nil attribute in an instance document, therefore it seems 'impossible' to do conditional mapping based on this attribute.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-pagination: none; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;For each element that is nillable, the customer needs to copy the value of the element (if any) to a node in the destination schema.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;They want to use an accompanying boolean node to indicate whether or not the element is set to nil in the input instance document.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-pagination: none; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&amp;nbsp;&lt;/P&gt;&lt;/SPAN&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-pagination: none; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;Example of Source Schema (Contains nillable elements)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-pagination: none; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;
&lt;P align=left&gt;&lt;IMG src="http://62.253.162.10/roy.wilson/blogscreenshots/schema1a.jpg"&gt;&lt;/P&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-pagination: none; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;Example of Destination Schema&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-pagination: none; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&amp;nbsp;&lt;/P&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-pagination: none; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;IMG src="http://62.253.162.10/roy.wilson/blogscreenshots/schema2.jpg"&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-pagination: none; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;U&gt;&lt;BR&gt;Solution&lt;BR&gt;&lt;/U&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-pagination: none; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;Being a developer, my first approach was to try to write a custom functoid for 2004 to emulate the functionality in 2006.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Hey, it shouldn't be that hard, right?&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Unfortunately looking at the published SDK samples it appears that functoids take either the name of the node or value of the node as inputs (depending on how the link is configured).&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Therefore, on the surface, there doesn't appear to be a way to pass a reference to the node itself, nor any easy way to get a reference to the original node.&lt;BR&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-pagination: none; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;My next approach was to try an inline XSLT template via the Scripting functoid.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Luckily this worked fine so I abandoned the custom functoid approach..!&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;This technique appears unintuitive to me due to 'lack of context'.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;By this I mean that there is no immediately obvious way to get the node reference (just the name or contents) as input, and therefore it is&amp;nbsp;likely to be&amp;nbsp;difficult to work out whether or not an instance node has the nil attribute set in map.&lt;BR&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-pagination: none; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;Fortunately, the XSLT call template is called within the&amp;nbsp;current node 'context'.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;I discovered this by displaying the name of the current node and running some tests of the map.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;The Biztalk mapper makes it quite easy to experiment with and test maps and since you can always examine the generated XSLT, it isn't really that hard to figure out how things are (or aren't) working.&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;The &lt;SPAN style="mso-spacerun: yes"&gt;screenshots&lt;/SPAN&gt;&amp;nbsp;below show the approach I used:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-pagination: none; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;
&lt;P align=left&gt;Here is the mapper surface: 
&lt;P&gt;&lt;IMG src="http://62.253.162.10/roy.wilson/blogscreenshots/mappingnulls.jpg"&gt; 
&lt;P&gt;..and here is the detail of the Scripting (Inline XSLT) functoid: 
&lt;P&gt;&lt;IMG src="http://62.253.162.10/roy.wilson/blogscreenshots/inlinexslt.jpg"&gt;&lt;/P&gt;&lt;/SPAN&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-pagination: none; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;In summary, the best reusable approach would be to make use of the functionality in 2006, but if that isn't an option then the technique described here&amp;nbsp;may well work out for you.&amp;nbsp; I guess I should&amp;nbsp;sign off with a summary&amp;nbsp;of the pro's and con's, so that you can make your own mind up as to whether this approach will work for you.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-pagination: none; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&amp;nbsp;&lt;/P&gt;&lt;/SPAN&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-pagination: none; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;U&gt;Pros&lt;/U&gt;: Quick to implement, no need to write additional code outside the mapper, Handles xsi:nils, Approach can be generally applied to handle any attribute not supported by the mapper&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-pagination: none; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;U&gt;Cons&lt;/U&gt;: Less intuitive, doesn't replace a generic function,&amp;nbsp;requires XSLT knowledge (I would argue that you should learn this anyway if you're attempting to use the mapper since it makes things a lot easier),&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;n&lt;/SPAN&gt;ame of the target node is&amp;nbsp;fixed in the XSLT template.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-pagination: none; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-pagination: none; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;/SPAN&gt;Happy mapping! [:)]&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-pagination: none; mso-layout-grid-align: none"&gt;Roy.&lt;/SPAN&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=472748" width="1" height="1"&gt;</description></item></channel></rss>