Im looking for an xQuery form that returns a book category if that category contains more than x number of books. For example, if I have 4 categories; music, film, education, health, and they all have 1 book, except for music, which has 3, they need to list this category. Ive tried a number of queries, but everything seems to be correct, I just donβt get the result every time, I think that at some point I need to use a certain value? Not too sure.
The following is an example of a source that tests the query in an editor that does not save the source file as a file, so to check xQuery you need to start with:
eg. for $ x in / bookstore / book ...
<bookstore> <book category="Music"> <year> 2005 </year> <price> 50 </price> </book> <book category="Music"> <year> 2010 </year> <price> 35 </price> </book> <book category="Music"> <year> 1982 </year> <price> 70 </price> </book> <book category="Film"> <year> 2000 </year> <price> 10 </price> </book> <book category="Health"> <year> 1965 </year> <price> 50 </price> </book> <book category="Education"> <year> 2012 </year> <price> 70 </price> </book> </bookstore>
Any help is greatly appreciated!
thrash
source share