You were nearly there. Try the following stylesheet on your sample document
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:template match="text()" />
<xsl:template match="allgroup">
<xsl:apply-templates>
<xsl:sort select="name()" />
<xsl:sort select="SORT_ID" data-type="number"/>
<xsl:sort select="salary" data-type="number" order="descending"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="last" >
GROUP: <xsl:value-of select="name(..)"/> SORT_ID: <xsl:value-of select="../SORT_ID"/> SAL: <xsl:value-of select="../s
alary" /> NAME: <xsl:value-of select="." />, <xsl:value-of select="../first" />
</xsl:template>
</xsl:stylesheet> which will output
GROUP: group_1 SORT_ID: 1 SAL: 100000 NAME: Hill, Phil
GROUP: group_1 SORT_ID: 1 SAL: 89000 NAME: Tony, Graham
GROUP: group_1 SORT_ID: 2 SAL: 100000 NAME: Jack, Johnny
GROUP: group_1 SORT_ID: 2 SAL: 95000 NAME: Herbert, Johnny
GROUP: group_2 SORT_ID: 1 SAL: 100000 NAME: Hill, Phil