Hello, this seems to be critical bug in [BaseX7.8.2]. The following code

 

let $a := <element></element>

for $i in (1 to 5)

  return copy $b := $a modify (

    insert node attribute id { generate-id() } into $b

  )

  return $b

 

will return elements with the same IDs, i.e.:

 

<element id="id31442"/>

<element id="id31442"/>

<element id="id31442"/>

<element id="id31442"/>

<element id="id31442"/>