How do i return all the maximum values in xquery? I used max() but it only gives me one! Thanks.
<id>a</id>
<average>5</average>
<id>b</id>
<average>5</average>
<id>c</id>
<average>5</average>
<id>d</id>
<average>4</average>
<id>e</id>
<average>1</average>
and i want my results to be:
<id>a</id>
<id>b</id>
<id>c</id>
Thanks!
Use:
The above is both a correct XQuery and a correct XPath 2.0 solution.
Verification with Saxon EE 9.3.04 XQuery:
When the above XQUery is applied on the following XML document (the provided fragment, wrapped into a single top element to make it a well-formed XML document):
the wanted, correct result is produced:
When this XSLT 2.0 transformation is applied (using Saxon 9.1.05) on the same XML document (above):
again the same correct result is produced: