はい、ソートはfor-eachの後にノードを指定するとありますが、
実際並べたいカラムというのは関数呼び出しをしているカラムなのです。
グループ化して其々をカウントするには他に方法が思いつかなかったのです。

下のような感じで「ここ」がソートできればいいんですが・・

<xsl:for-each selectほげ[not(id = preceding-sibling::ほげ)]">
<xsl:sort select="ここ" order="ascending" />
<xsl:variable name="ここ">
<xsl:call-template name="関数">
<xsl:with-param name="引数">
<xsl:value-of select="値"/>
</xsl:with-param>
</xsl:call-template>
</xsl:variable>
<xsl:value-of select="$ここ"/>
</xsl:for-each>