Use this simple XPath 2.0 expression:
$vSeq[index-of($vSeq,.)[2]]
where $vSeq
is the sequence of values in which we want to find the duplicates.
For explanation of how this "works", see:
http://dnovatchev.wordpress.com/2008/11/16/xpath-2-0-gems-find-all-duplicate-values-in-a-sequence-part-2/
TLDR;
This picture can be a visual explanation.
If the sequence is:
$vSeq = 1, 2, 3, 2, 4, 5, 6, 7, 5, 7, 5
Then evaluating the above XPath expression produces: 2, 5, 7
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…