biztalk community

Join Our Mailing List
E-mail Address :
Tomas Restrepo - Devdeo

The BizTalker

March 3rd, 2006
Volume 03


Sorting Using XSLT Inside a BizTalk Map by Stephen W. Thomas
Sorting data inside BizTalk is a common requirement. Typical scenarios require data sorted by order number, by customer id, order amount, last name, or anything else. This is a simple task using Custom XSLT and a BizTalk map.

Take the following schema:

To sort this data inside a map, use a Script Functoid and Inline XSLT Code like this:

<xsl:for-each select="Record">
<xsl:sort select="Id" data-type="number" order="ascending"/>

This will only sort that data. Additional effort is needed to map the data to the destination schema. When using inline XSLT or a XSLT Template, all nodes and subnodes created by the XSLT needed to be inside the code (i.e. you can not use the mapper GUI). So, the final Inline XSLT to sort and map the data to itself would look like this:

<xsl:for-each select="Record">
<xsl:sort select="Id" data-type="number" order="ascending"/>
<xsl:element name="Record">
<xsl:copy-of select="./*" />

If you were mapping the data to a schema with a different structure you could not use the copy-of select="./" bulk copy command. Each field would need to be listed inside the XSLT like this:

<xsl:for-each select="Record">
<xsl:sort select="Id" data-type="number" order="ascending"/>
<xsl:element name="Customers">
<xsl:element name="Num"><xsl:value-of select="Id" /></xsl:element>
<xsl:element name="Name"><xsl:value-of select="Name" /></xsl:element>
<xsl:element name="CustNum"><xsl:value-of select="CustomerNumber" /></xsl:element>
<xsl:element name="Total"><xsl:value-of select="OrderTotal" /></xsl:element>

See both of these scripts in action in this sample: Sample Sort. This sample has two maps and an input file. The result of testing each map will be sorted output.

Watch for a more Sorting and Grouping using XSLT on in the near future. Get more information on xsl:sort at W3Schools.

Business Rules Must Have Tool by Acumen Business
If you have worked with the BizTalk Business Rules Engine and worked with vocabularies you know the pain for having to update Polices when you version and update your vocabularies. This tedious task is made trivial thanks for Acuman Business. They have a free tool to totally simplify vocabulary management! In addition, there Policy Verificator tool will help document your rules, list dependencies, print rules, and produce rocking dependency maps.

This tool is an absolute must have and best of all it is currently free. Get more information and register for there software on there site:

Microsoft Launch's 2 e-Learning Courses for BizTalk 2006
With the release of BizTalk Server 2006 sometime in the near feature, Microsoft has released two new courses to help get Developers and IT Professionals up to speed on the new features! As best I can tell, this content is free.

Clinic 2954: First Look: Microsoft BizTalk Server 2006 for Developers
Clinic 2955: First Look: Microsoft® BizTalk Server 2006 for IT Professionals

BizTalk Clinics Are Coming to a City Near you
These little known and not very well promoted BizTalk clinics are coming to a city near you. Currently over 20 sessions are still scheduled all over the US. Visit: for more information.

As best I can tell, these clinics cover the same material as the e-Learning Courses and they are free.

Get additional information on Web Casts and Events on the Business Process and Integration Events Site. New Downloads
Self Correlation and Passing Configured Port Parameters Sample
This sample shows how to Start two different Orchestrations and receive a response message without any Correlation Set to configure using Self Correlation and Passing Configured Ports into a Started Orchestration.

Business Rules in Net Code
This sample shows how to call the BizTalk Business Rules from .net code. This sample passes in .net objects as facts and gets updated values returned from the rules engine. It also uses a long term fact creator defined on the Policy to cache long term facts. Make sure you read the ReadMe.txt for set up information

Comments or Suggestions?
I welcome comments, questions, and suggestions. After all, this newsletter is about delivering content you want to hear about! Feel free to contact me through the forum or via e-mail.

Until next time...
Stephen W. Thomas -
Before my BizTalk days, I sold Star Wars toys and collectibles full time on-line and at trade shows all over the US. That got me into web development, that got me into consulting, and now here I, and now here I am.

Don't forget to visit our friend sites:

BizTalkGurus Forum