title: XPath - Get nodes with distinct text values from a non repetitive list
body: <p>I have an XML as below : </p>
  
  <pre><code>&lt;object&gt;
      &lt;codes&gt;
          &lt;cd1&gt;A&lt;/cd1&gt;
          &lt;cd2&gt;B&lt;/cd2&gt;
          &lt;cd3&gt;C&lt;/cd3&gt;
      &lt;/codes&gt;
      &lt;codes&gt;
          &lt;cd1&gt;A&lt;/cd1&gt;
          &lt;cd2&gt;D&lt;/cd2&gt;
          &lt;cd3&gt;&lt;/cd3&gt;
      &lt;/codes&gt;
      &lt;codes&gt;
          &lt;cd1&gt;E&lt;/cd1&gt;
          &lt;cd2&gt;D&lt;/cd2&gt;
          &lt;cd3&gt;&lt;/cd3&gt;
      &lt;/codes&gt;
  &lt;/object&gt;
  </code></pre>
  
  <p>So far my XPath evolution has been as below : </p>
  
  <ol>
  <li><p><code>//cd1|//cd2|//cd3</code> : Gets all cd1, cd2 and cd3 elements</p></li>
  <li><p><code>(//cd1|//cd2|//cd3)[text()[1]]</code> : Filters all elements with non-empty text value from above list and returns the below elements.</p>
  
  <p><code>&lt;cd1&gt;A&lt;/cd1&gt;
  &lt;cd2&gt;B&lt;/cd2&gt;
  &lt;cd3&gt;C&lt;/cd3&gt;
  &lt;cd1&gt;A&lt;/cd1&gt;
  &lt;cd2&gt;D&lt;/cd2&gt;
  &lt;cd1&gt;E&lt;/cd1&gt;
  &lt;cd2&gt;D&lt;/cd2&gt;</code></p></li>
  <li><p>Now I need to remove the elements that have repeating text values. I have tried xpath as <code>(//cd1|//cd2|//cd3)[text()[1]][(preceding::cd1)|(preceding::cd2)|(preceding::cd3)]</code> . What I am 
  hoping to achieve is to check whether the value is preceding in any of cd1 or cd2 or cd3 above. But this returns below where <code>&lt;cd2&gt;D&lt;/cd2&gt;</code> is repeating.</p>
  
  <p><code>&lt;cd2&gt;B&lt;/cd2&gt;
  &lt;cd3&gt;C&lt;/cd3&gt;
  &lt;cd1&gt;A&lt;/cd1&gt;
  &lt;cd2&gt;D&lt;/cd2&gt;
  &lt;cd1&gt;E&lt;/cd1&gt;
  &lt;cd2&gt;D&lt;/cd2&gt;</code></p></li>
  </ol>
  
  <p>How can I write an xpath to solve above (3) ?</p>
  
  <p>Please note I have to use Xpath 1.0 , therefore distinct-values function is not an option. Also, I need to get the matching node list, not the text values from the xpath, since I have to do some more processing on these nodes using AXIOM.</p>
  
  <p>Update : I am using this xpath to get matching elements which will be then processed with AXIOM. Therefore, I need to write a single xpath expression to get the matching elements in one go (I cannot write custom flows in AXIOM or using XSLT). Also cd* cannot be used because the real names are not matching. I have used a sample here. </p>