title: Counting nr of elements in a file
body: <p>I am trying to count the number of Harbour elements in an XML file. However, i keep getting the following error:</p>
  
  <pre><code>item expected, sequence found: (element harbour {...}, ...)
  </code></pre>
  
  <p>The code snippet is the following: </p>
  
  <pre><code>for $harbour in distinct-values(/VOC/voyage/leftpage/harbour)
  let $count := count(/VOC/voyage/leftpage/harbour eq $harbour)
  return concat($harbour, " ", $count)
  </code></pre>
  
  <p>Input XML:</p>
  
  <pre><code>&lt;voyage&gt; 
    &lt;number&gt;4411&lt;/number&gt; 
    &lt;leftpage&gt; 
      &lt;harbour&gt;Rammekens&lt;/harbour&gt; 
    &lt;/leftpage&gt; 
  &lt;/voyage&gt; 
  &lt;voyage&gt; 
    &lt;number&gt;4412&lt;/number&gt; 
    &lt;leftpage&gt; 
      &lt;harbour&gt;Texel&lt;/harbour&gt; 
    &lt;/leftpage&gt; 
  &lt;/voyage&gt;
  </code></pre>
  
  <p>Can someone help me out? How do I iterate over the number of harbours in the XML file instead of trying to use <code>/VOC/voyage/leftpage/harbour</code>?</p>