This does what you want - there is probably a simpler way but I'm not that good at XSLT 1.0 grouping myself.
A couple of pointers - your xsl:key - was completely empty - there are no RECORD element that are children of the root, therefore match="RECORD/field" would not match anything.
Code:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" indent="yes"/>
<xsl:key name="group_by_mgrid" match="/EXTRACT/RECORDS/RECORD/field[@name='mgr_Code']" use="."/>
<xsl:template match="/EXTRACT/RECORDS">
<myrecords>
<xsl:for-each select="RECORD/field[generate-id() = generate-id(key('group_by_mgrid',.)[1])]">
<row>
<mgr_Code>
<xsl:value-of select="."/>
</mgr_Code>
<Department>
<xsl:for-each select="key('group_by_mgrid', .)/../field[@name='dept_Code']">
<Dept_Code>
<xsl:value-of select="."/>
</Dept_Code>
</xsl:for-each>
</Department>
</row>
</xsl:for-each>
</myrecords>
</xsl:template>
</xsl:stylesheet>
/- Sam Judson : Wrox Technical Editor -/