Hi Pascal,

it comes down to a syntax error - there's a 'return' statement missing
before the 'copy'. It should work like this:

declare namespace ddi = "http://www.icpsr.umich.edu/DDI";
let $codeBook := collection()[1]/ddi:codeBook
let $titlStmt := $codeBook/ddi:stdyDscr/ddi:citation/ddi:titlStmt
return copy $titlStmt1 := $titlStmt
modify (
   rename node $titlStmt1 as
QName('http://www.icpsr.umich.edu/DDI','CopyOfTitlStmt')
)
return $titlStmt1

I always check queries in the Query Editor of BaseX if I come across
issues like this. Just as a hint ...


Cheers,
Lukas