I am trying to find duplicates in my xml data and from that I would like to apply condition.
Â
Â
here is my xml docÂ
Â
<results>
    <book>
        <id>1</id> <status> published</status>
    </book>
    <book>
        <id>1</id> <status> not published</status>
    </book>
    <book>
        <id>2</id> <status> sold</status>
    </book>
</results>
From the above xml, I want to find book id where id's are repeated and the status is published then return
Â
.<book>Â Â <id>1</id>Â <status>Â published</status>Â </book>
using XQuery  .Â
Could you please help me on this. Thanks in advance.