I'm afraid those of us who use XSLT 2.0 every day find coding within the limitations of 1.0 a distinctly unenjoyable experience. This one can be done though - provided you have access to an xx:node-set() extension function. The logic is
(a) create a variable (a result tree fragment in 1.0 terms) holding the sorted nodes:
<xsl:variable name="x">
<xsl:for-each select="row">
<xsl:sort ...
<xsl:copy-of select="."/>
</xsl:variable>
(b) turn this into a node-set
<xsl:variable name="sorted-nodes" select="xx:node-set($x0)/row"/>
(c) process these nodes
<row ... data02="{sum($sorted-nodes[position() > 9])}"/>
<xsl:for-each select="$sorted-nodes[position() <= 9]">
...
</xsl:for-each>
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer's Reference