Note that there are some explanatory texts on larger screens.

plurals
  1. POxQuery - count function
    text
    copied!<p>Im looking to form an xQuery which returns the category of a book if this category contains more than x amount of books. For example if I have 4 categories; music, film, education, health and they all have 1 book in, apart from music which has 3, im looking to list that category. Ive tried a range of queries but cant seem to get it right, I just get no result everytime, I believe I need to be using distinct-value at some point? Not too sure.</p> <p>An example of the source can be seen below, im testing the query in an editor which doesnt save the source as a file so for me to test the xQuery has to start with:</p> <p>e.g. for $x in /bookstore/book...</p> <pre><code>&lt;bookstore&gt; &lt;book category="Music"&gt; &lt;year&gt;  2005  &lt;/year&gt; &lt;price&gt;  50  &lt;/price&gt; &lt;/book&gt; &lt;book category="Music"&gt; &lt;year&gt;  2010  &lt;/year&gt; &lt;price&gt;  35  &lt;/price&gt; &lt;/book&gt; &lt;book category="Music"&gt; &lt;year&gt;  1982  &lt;/year&gt; &lt;price&gt;  70  &lt;/price&gt; &lt;/book&gt; &lt;book category="Film"&gt; &lt;year&gt;  2000  &lt;/year&gt; &lt;price&gt;  10  &lt;/price&gt; &lt;/book&gt; &lt;book category="Health"&gt; &lt;year&gt;  1965  &lt;/year&gt; &lt;price&gt;  50  &lt;/price&gt; &lt;/book&gt; &lt;book category="Education"&gt; &lt;year&gt;  2012  &lt;/year&gt; &lt;price&gt;  70  &lt;/price&gt; &lt;/book&gt; &lt;/bookstore&gt; </code></pre> <p>Any help is massively appreciated!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload