You can use any grouping method to find groups of elements with matching values (use <xsl:for-each-group> in XSLT 2.0, or Muenchian grouping in 1.0 - see
http://www.jenitennison.com/xslt/grouping). Then display the grouping key for any group whose size is >1.
In 2.0:
<xsl:template match="elementname">
<xsl:for-each-group select="*" group-by="@xml:lang">
<xsl:if test="count(current-group()) gt 1">
There is >1 with key <xsl:value-of select="current-grouping-key()"/>
</xsl:if>
</xsl:for-each-group>
</xsl:template>
Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference