Dirk, 

Thank you for your quick response. 

Upon your suggestion (and prior to that) I checked that the values for $r are different. Indeed they are. But, what I didn't check until your suggestion is that the values of fn:string($r) are different. They in fact are the same - thank you for your suggestion. 

Is it possible that there is some sort of type casting related issue going on where I call fn:string($r)? 

I get different values for the hash of each attribute value when I select attributes in the collection like: 

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


when I select elements in the collection like:

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

I found that the value of fn:string($r) is blank for all values of $r (which are different) which is why the hash is the same.

I appreciate your help.

Buzz


On Fri, Nov 1, 2013 at 2:52 AM, Dirk Kirsten <dk@basex.org> wrote:
Hello buzz,

it is ok to also ask more general XQuery questions on this list.

For testing I executed the following query:

for $r in ("123", "234", "345")
let $hash := xs:hexBinary(hash:md5(fn:string($r)))
return $hash

which yields different results for each value of $r. Are you absolutely
sure you have different values for $r (you can check using trace())?
Also, given they query I would be very suprised if indeed it shows the
same result.

Cheers,
Dirk

On 01/11/13 08:24, buzz chopra wrote:
> 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
>
>
>
> _______________________________________________
> BaseX-Talk mailing list
> BaseX-Talk@mailman.uni-konstanz.de
> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
>

--
Dirk Kirsten, BaseX GmbH, http://basex.org
|-- Firmensitz: Blarerstrasse 56, 78462 Konstanz
|-- Registergericht Freiburg, HRB: 708285, Geschäftsführer:
|   Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle
`-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22
_______________________________________________
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk