Many JAXP implementations allow you to call Java methods on Java objects as extension functions, but the details depend on the product you are using (it's not defined in the JAXP interface itself). So consult your product documentation. In Saxon you could pass the HashMap directly as a parameter to the transformer and then access it as:
<xsl:value-of select="Map:get($map, 'countryname')"
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference