title: XPath to get Unique Element Names
body: <p>I want to use XPath to get a list of the names of all the elements that appear in an XML file. However, I don't want any names repeated, so an element with the same name as a preceding element should not be matched. So far, I've got:</p>
  
  <pre><code>*[not(local-name() = local-name(preceding::*))]
  </code></pre>
  
  <p>This executes alright but it spits out duplicates. Why does it spit out the duplicates and how can I eliminate them? (I'm using Firefox's XPath engine.)</p>