My blog has moved!

Visit http://blog.adamroderick.com/ and update your bookmarks.

Thursday, June 25, 2009

Revisiting Splitting Delimited Values in BizTalk Maps

I needed to split a pipe delimited string of unknown length and create one output node for each delimited item. Easy to do, but not so much in a BizTalk map. Thankfully, Richard had a good post on calling an XSL transormation in the map to accomplish this.

The one problem I ran into was, in my case, the pipe delimited string might be empty. Richard's solution ended up generating a single, empty node in my output message. If the input string was empty, I wanted no nodes generated on the output. I modified the XSL to accomplish this. Follow Richard's steps, then use the XSL from below:





<xsl:template name="WritePropertyNodeTemplate">
<xsl:param name="input" />

<!-- create property node -->
<!-- create single instance children nodes -->
<!-- call splitter template which accepts the "|" separated string -->
<xsl:if test="string-length($input) > 0">
<xsl:call-template name="StringSplit">
<xsl:with-param name="val" select="$input" />
</xsl:call-template>
</xsl:if>
</xsl:template>

<!-- This template accepts a string and pulls out the value before the designated delimiter -->
<xsl:template name="StringSplit">
<xsl:param name="val" />

<!-- do a check to see if the input string (still) has a "|" in it -->
<xsl:choose>
<xsl:when test="contains($val, '|')">
<!-- pull out the value of the string before the "|" delimiter -->
<TrackingNumber><xsl:value-of select="substring-before($val, '|')" /></TrackingNumber>
<!-- recursively call this template and pass in value AFTER the "|" delimiter -->
<xsl:call-template name="StringSplit">
<xsl:with-param name="val" select="substring-after($val, '|')" />
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<!-- if there is no more delimiter values, print out the whole string -->
<TrackingNumber><xsl:value-of select="$val" /></TrackingNumber>
</xsl:otherwise>
</xsl:choose>

</xsl:template>

Monday, June 22, 2009

jQuery Demonstration Code

I gave a presentation "jQuery Makes Javascript Fun and Easy!" to the South Colorado .NET User Group. Most of the presentation was live demo, so I do not have the exact code examples, but I based the demos off of some introductory code I had previously prepared. Click below to download. Enjoy!

Intro to jQuery

The code includes enough to get you started using jQuery.