title: How to count distinct values in a node?
body: <p>How to count distinct values in a node in XSLT?</p>
  
  <p>Example: I want to count the number of existing countries in Country nodes, in this case, it would be 3.</p>
  
  <pre><code>&lt;Artists_by_Countries&gt;
      &lt;Artist_by_Country&gt;
          &lt;Location_ID&gt;62&lt;/Location_ID&gt;
          &lt;Artist_ID&gt;212&lt;/Artist_ID&gt;
          &lt;Country&gt;Argentina&lt;/Country&gt;
      &lt;/Artist_by_Country&gt;
      &lt;Artist_by_Country&gt;
          &lt;Location_ID&gt;4&lt;/Location_ID&gt;
          &lt;Artist_ID&gt;108&lt;/Artist_ID&gt;
          &lt;Country&gt;Australia&lt;/Country&gt;
      &lt;/Artist_by_Country&gt;
      &lt;Artist_by_Country&gt;
          &lt;Location_ID&gt;4&lt;/Location_ID&gt;
          &lt;Artist_ID&gt;111&lt;/Artist_ID&gt;
          &lt;Country&gt;Australia&lt;/Country&gt;
      &lt;/Artist_by_Country&gt;
      &lt;Artist_by_Country&gt;
          &lt;Location_ID&gt;12&lt;/Location_ID&gt;
          &lt;Artist_ID&gt;78&lt;/Artist_ID&gt;
          &lt;Country&gt;Germany&lt;/Country&gt;
      &lt;/Artist_by_Country&gt;
  &lt;/Artists_by_Countries&gt;
  </code></pre>