This XSLT 1.0 transformation:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="fields">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:apply-templates>
<xsl:sort select="@position" data-type="number"/>
</xsl:apply-templates>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
when applied on the provided XML document:
<fields>
<field position="4" tablename="Students" headername="First Name" fieldreference="FirstName" orderbydirection="ASC" />
<field position="2" tablename="Students" headername="Last Name" fieldreference="LastName" orderbydirection="ASC" />
<field position="3" tablename="Students" headername="Race" fieldreference="Race" orderbydirection="ASC" />
<field position="1" tablename="Students" headername="Sex" fieldreference="Sex" orderbydirection="ASC" />
<field position="5" tablename="Students" headername="State" fieldreference="State" orderbydirection="ASC" />
</fields>
produces the wanted result:
<fields>
<field position="1" tablename="Students" headername="Sex" fieldreference="Sex" orderbydirection="ASC" />
<field position="2" tablename="Students" headername="Last Name" fieldreference="LastName" orderbydirection="ASC" />
<field position="3" tablename="Students" headername="Race" fieldreference="Race" orderbydirection="ASC" />
<field position="4" tablename="Students" headername="First Name" fieldreference="FirstName" orderbydirection="ASC" />
<field position="5" tablename="Students" headername="State" fieldreference="State" orderbydirection="ASC" />
</fields>