OK, so after carefully reading Jeni Tennison's tutorial I've figured it out.
<xsl:stylesheet version="1.0">
<xsl:key name="key-authors" match="record" use="author" />
<xsl:template match="log">
<xsl:for-each select="record[generate-id() = generate-id(key('kAuthors',author)[1])]">
<xsl:sort select="./author" />
<xsl:value-of select="./author" />
<xsl:for-each select="key('kAuthors',./author)">
<xsl:apply-templates select="."/>
</xsl:for-each>
</xsl:for-each>
</xsl:template>
<xsl:template match="record">
<!-- do whatever with the record values: @id, author, ts, data -->
</xsl:template>
</xsl:stylesheet>
Thanks, michael.hor257k.