Return equal nodes


I am new here on kirupa forum and this is my first post:}
Well, starting with a problem, i have a xml file and i want to compare data.
I want to return the equal nodes within a new XMLList or Array;

<checkNode name=“title” ids=“2,3,4” />

atrribute (ids) checking in;

<node id=“1” name=“title” />
<node id=“2” name=“title” />
<node id=“3” name=“title” />
<node id=“4” name=“title” />

and return equal nodes.

Can’t figure it out. Hope to see your reply.