This may be a question better suited for an xquery forum but I'll start here since I'm using basex:

Can someone suggest why I'd be getting the same result for the hash call even though
the content of $r should be changing? 

  let $reps := fn:collection($coll)/Rep
  for $r at $lcv in $reps
    let $hash := xs:hexBinary(hash:md5(fn:string($r)))
    return <hash i="{$lcv}">{$hash}</hash>
};

Please let me know if I should post this elsewhere (and please include where). 

Thanks in advance for any suggestions.

Buzz