Easy in version 2.0:
<xsl:sort select="if (../@name = 'thing') then @name else @sort"/>
More convoluted in 1.0:
<xsl:sort select="@name[../../@name = 'thing'] |
@sort[../../@name != 'thing']"/>
(The first .. takes you back from the attribute to the level2 element, the second takes you back to the level1)
Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference