There is something quirky going on that I can't explain. If you add a simple XML file with no schema (with int and string elements) to the Data Source Catalog and open the Sort & Group dialog for the Data View you get the choice of sorting on elements containing numeric values as numeric values - and not as strings. This is shown in the dialog as <fieldname>(Number).

For some strange reason this does not appear when you want to sort numeric values returned through a web service...

Anyway, to fix it:

  1. Select the desired sort field in the dialog.
  2. Edit the XSL - look for the dvt_1.body template, find the xsl:for-each and the xsl:sort within it that selects your sort field - add the attribute data-type="number"
  3. Voi la