<authors>
<author affiliation="Oxford">Brady</author>
<author affiliation="Rutherford">Burren</author>
<author affiliation="Brookes">Duce</author>
<author affiliation="Oxford">Hoare</author>
<author affiliation="Brookes">Hopgood</author>
<author affiliation="Rutherford">Matthews</author>
</authors>
<xsl:template match="authors"> XSLT 2.0
<xsl:for-each-group select="author" group-by="@affiliation">
<affilation name="{current-grouping-key()}">
<xsl:copy-of select="current-group()"/>
</affilation>
</xsl:for-each-group>
</xsl:template>
<affilation name="Oxford">
<author affiliation="Oxford">Brady</author>
<author affiliation="Oxford">Hoare</author>
</affilation>
<affilation name="Rutherford">
<author affiliation="Rutherford">Burren</author>
<author affiliation="Rutherford">Matthews</author>
</affilation>
<affilation name="Brookes">
<author affiliation="Brookes">Duce</author>
<author affiliation="Brookes">Hopgood</author>
</affilation>