You logic is:
<xsl:when test="number($sortCol) != 0 and //Row[position() != last()]">
"if $sortCol is not zero and there is a row that is not the last row"
<xsl:apply-templates select="//Row" mode="data">
<xsl:sort
"then sort all the rows".
What you want to say is "sort all the rows except the last one and then output the last row". That is:
<xsl:apply-templates select="(//Row)[position()!=last()]" mode="data">
<xsl:sort ... />
</xsl:apply-templates>
<xsl:apply-templates select="(//Row)[last()]"/>
Note also the difference between (//Row)[last()] and (//Row[last()]). The first expression selects the last of all the rows, the second expression selects every Row that is the last child of its parent.
Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference