XSL comparison of nodes
===

Hello I am new to xml and would like to compare some values using an xsl stylesheet

    `<a>
     <b>   <name>foo</name>   </b>
     <b>   <name>bar</name>   </b>
     <b>   <name>fred</name>  </b>
     <b>   <name>fred</name>  </b>
     </a>`

I would like to write a style sheet that checks all the b nodes and returns the values that have the same value so using the simple example above i would like the output to resemble :   
"Your duplicate strings are fred"

I have used a for each loop to return all the values but comparing the names and returning the duplicates has eluded me.If possible i would like to achieve the comparison by the use of a while type loop.

Thank you for any help.


 