Geeks With Blogs
Mark Wiggins blog

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.

Posted on Thursday, October 12, 2006 3:41 PM | Back to top


Comments on this post: XSLT in BizTalk 2006 Map

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Mark Wiggins | Powered by: GeeksWithBlogs.net