So after looking around the net to see if someone else has had to deal with this challenge, a colleague forwarded on this link to me by Michael J. Williams. The context of this link was pure XSLT with nothing BizTalk related in it.
So I figured that I would create a post that would show you how you can do something similiar, but how you would accomplish this inside of BizTalk.
So to further illustrate what my inbound message looks like, here is an example:
For both VEHICLE_LIST and EMPLOYEE_LIST I am expecting a list of values separated by commas within one element.
However, the destination system is expecting them in their own element as shown below:
Within the Scripting Functoid I am going to call an "Inline XSLT Template".
The XSLT requires two parameters:
- The list of Employees( or Vehicles)
- A delimiter character - in my example I am using a comma ','
Here is the code listing that I have used and is based upon Michael's post. I have made a few modifications including:
- Removing his inititial template. In his example he had one template calling another. In my example, it is the scripting functoid that is initating the XSLT call and the parameters come from the Functoid input parameters.
- Included the
tags to reflect my requirements.
- Provide a check to deal with a comma being included in the list but no value is included.
<xsl:param name="list" />
<xsl:param name="delimiter" />
<xsl:when test="contains($list, $delimiter)">
<xsl:value-of select="normalize-space($list)" />
<xsl:value-of select="concat(normalize-space($list), $delimiter)" />
<xsl:variable name="first" select="substring-before($newlist, $delimiter)" />
<xsl:variable name="remaining" select="substring-after($newlist, $delimiter)" />
<xsl:if test ="string-length($first) != 0">
<xsl:value-of select="$first" />
<xsl:with-param name="list" select="$remaining" />
<xsl:value-of select="$delimiter" />