XQuery's flwor-expressions know order by
, which can order by arbitrary values which can also be computed. Use an expression which decides if some product is a "top product" or not (resulting in a boolean value).
Afterwards split up result sequence to highlight only a number of results and limit to a total results.
let $highlighted := 3
let $total := 10
let $sorted :=
for $p in //property
(: order by highlighting predicate :)
order by $p/agency eq "ABC" and $p/zip_code eq "XYZ" descending
return $p
return (
(: first $highlighted elements as defined by predicates above :)
$sorted[ position() = (1 to $highlighted) ],
(: the other elements, `/.` forces sorting back to document order :)
$sorted[ position() = ($highlighted + 1 to $total) ]/.
)
The boolean expression can get arbitrary complex for being more precise on top products, like limiting to TVs or defining some minimum price.