This stylesheet:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output indent="yes" omit-xml-declaration="yes"/>
<xsl:template match="root">
<xsl:for-each select="a/*[string(number(.))!='NaN']">
<xsl:sort select="." order="descending"/>
<xsl:if test="position() = 1">
<highest><xsl:copy-of select="."/></highest>
</xsl:if>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
when applied to the edited input XML above, outputs
<highest>
<d>22</d>
</highest>