You can't list all the attributes that could possibly appear on an element, but you can list those that actually do appear using @*
But perhaps I've misunderstood your question, and it's not the set of attribute names that you are interested in, but the set of attribute values. This starts to look like a grouping problem:
<xsl:for-each-group select="header/language" group-by="@lang">
<xsl:value-of select="count(current-group()/entry)"/>
</xsl:for-each-group>
Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference