Sorting by Number in DVWPs

If you set up a sort in a DVWP that has an aggregate Data Source, you’ll need to use the <xsl:sort> tag.  If you want to sort by a list column that is numeric, the tag:
<xsl:sort select=”@JobFamilyRank” order=”ascending”/>
will sort your data like: 1, 10, 11, 12, 2, 20, 21, 3…  That is, SharePoint will treat your column as if it contains left justified text.
 
Be sure to add the data-type parameter:
<xsl:sort select=”@JobFamilyRank” order=”ascending” data-type=”number”/>
and then the sort will work as you wanted: 1, 2, 3, 10, 11, 12, 20, 21,…

Have a thought or opinion?