Ravindar, Integrations with Mulesoft & BizTalk

Just another Integration blog

Using EXSLT in BizTalk

we need to create a xml that has EXSLT assembly like for example below

<?xml version="1.0" encoding="utf-8"?>
<ExtensionObjects>
    <ExtensionObject
     Namespace="http://exslt.org/dates-and-times"
     AssemblyName="Mvp.Xml,
     Version=2.3.0.0, Culture=neutral,
     PublicKeyToken=6ead800d778c9b9f"
     ClassName="Mvp.Xml.Exslt.ExsltDatesAndTimes"/>
</ExtensionObjects>

and now if you want to you EXSLT date funtion in your custom xslt, then mention like below

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:S1="http://ExtendedMapping.Schema1"
                xmlns:S2="http://ExtendedMapping.Schema2"
                xmlns:exslt="http://exslt.org/dates-and-times"
                version="1.0">
 
    <xsl:template match="/">
        <S2:Root>
            <Field>
                <xsl:value-of select="exslt:dateTime()"/>
            </Field>
        </S2:Root>
    </xsl:template>
</xsl:stylesheet>

And to loop through each distict node (faster grouping) in fast way,
you can use Distinct() function of EXSLT like below

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:set="http://exslt.org/sets">
  <xsl:output indent="yes"/>
  <xsl:key name="countryKey" match="orders" use="ID"/>
  <xsl:template match="root">
    <table border="1">
      <tr>
        <th>Order ID</th>
        <th>Ship City</th>
      </tr>
      <xsl:for-each select="set:distinct(orders/ID)/..">
        <tr>
          <th colspan="2">
            <xsl:value-of select="ID/text()"/>
          </th>
        </tr>
        <xsl:for-each select="key('countryKey',ID)">
          <tr>
            <td>
              <xsl:value-of select="@OrderID"/>
            </td>
            <td>
              <xsl:value-of select="@ShipCity"/>
            </td>
          </tr>
        </xsl:for-each>
      </xsl:for-each>
    </table>
  </xsl:template>
</xsl:stylesheet> 

and don’t forget to read below URLs
http://www.richardhallgren.com/how-the-extend-a-custom-xslt-in-biztalk-using-exslt-and-the-mvpxml-project/

http://msdn.microsoft.com/en-us/library/aa302297.aspx#xmlindexing_topic3

January 22, 2012 - Posted by | Biztalk Server

No comments yet.

Leave a comment