
math:rank( $arg1 as xs:anyAtomicType*, $arg2 as xs:anyAtomicType, [$options as xs:string*] ) as xs:integer?
  Returns the rank of a value in a data set. Ranks are skipped in the event
  of ties. If the given value is not equal to any item in the sequence, the
  function returns the empty sequence. The function can be used on numeric
  values, xs:yearMonthDuration, xs:dayTimeDuration, 
  xs:string, xs:anyURI,
  xs:date, xs:dateTime, xs:time,
  and cts:point.
math:rank((1, 7, 5, 5, 10, 9),9) => 5
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.