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"/>
Hello Sergey,
Based on the spec (http://www.w3.org/TR/xpath-functions-30/#func-generate-id) generate-id() uses the context-item if no argument is present. As the context item is the same in each of your calls, it will return the same id.
Using generate-id($b) should be enough to generate distinct ids.
Cheers, Dirk
On 10/07/14 02:56, Sergey Alekhin wrote:
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"/>
basex-talk@mailman.uni-konstanz.de