Replace duplicated attribute values with element names
===

Let's assume I have following XML:

    <element1 title="title1">
    <element2 title="title2">
    <element3 title="title1">

Here attribute title is duplicated for `element1` and `element3`. I would like to find all elements with duplicated `title` and replace `title` values with names of elements. So, the example above would be:

    <element1 title="element1">
    <element2 title="title2">
    <element3 title="element3">

How is it possible to do with XSLT 1.0 ?



