XSLT in BizTalk 2006 Map

Sometimes it is useful to create an XSLT template for use in a map using the mapper. Creating a template for reuse during the map is not as hard as it may seem.

 

First, Drag 2 scripting functoids to the map canvas.

The first scripting functoid needs to be setup as an XSLT Template.  Here is some sample code to put in the template.

<xsl:template name="to-numeric">
  <xsl:param name="input"/>
  <xsl:choose>
   </xsl:when>
   <xsl:when test="contains($input, '%')">
    <xsl:value-of select="substring-before($input, '%') div 100"/>
   </xsl:when>
   <xsl:when test="string(number($input)) = 'NaN'">0</xsl:when>
   <xsl:otherwise>
    <xsl:value-of select="number($input)"/>
   </xsl:otherwise>
  </xsl:choose>
 </xsl:template>

 

The second step is to go to the other scripting functoid that you have on the canvas and change it to be inline XSLT.

Here is some sample code to add to the scripting functoid.

<xsl:attribute name="SomeAttrib">
<xsl:call-template name="to-numeric">
<xsl:with-param name="input" select="normalize-space(@someValue)"/>
</xsl:call-template></xsl:attribute>

 

As you can see the inline XSLT actually creates the attribute, calls the template, and passes the parameter.

 

I hope you find this helpful.

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati
«October»
SunMonTueWedThuFriSat
24252627282930
1234567
891011121314
15161718192021
22232425262728
2930311234