Can't use xsl:sort as is. See
https://stackoverflow.com/questions/42806139/using-preceding-sibling-with-with-xslsort[
^].
Your best bet is to sort it to another XML node-set and then parse it.
The following works somewhat.
This adds an extra | at the end. Also added Elements as a root element for the XML.
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="yes" />
<xsl:key name="Token" match="Element" use="Token" />
<xsl:template match="Elements">
<xsl:apply-templates select="Element[generate-id(.)=generate-id(key('Token',Token)[1])]"/>
</xsl:template>
<xsl:template match="Element">
<xsl:for-each select="key('Token', Token)">
<xsl:sort select="Token"/>
<xsl:value-of select="Values"/>
<xsl:variable name="var1">
<xsl:value-of select="Token"/>
</xsl:variable>
<xsl:variable name="var2">
<xsl:value-of select="following::Token"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="not($var2='')">
<xsl:choose>
<xsl:when test="not(position()=last())">;</xsl:when>
<xsl:otherwise>|</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>|</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>