Hi, after a lot of data has been gathered, I realized that my update-function has a bug. It's not a big deal fixing it, however, I don't know how to resort the existing data. Essentially, I wanted to create this kind of data: <collection> <entry> <node>123</node> <query>xyz</query> <secondquery>abc_1</secondquery> <secondquery>abc_2</secondquery> </entry> <entry> <node>456</node> <query>xyz</query> <secondquery>abc_1</secondquery> <secondquery>abc_3</secondquery> <secondquery>abc_4</secondquery> </entry> </collection> However, the data looks like this: <collection> <entry> <node>123</node> <query>xyz</query> </entry> <secondquery>abc_1</secondquery> <secondquery>abc_2</secondquery> <entry> <node>456</node> <query>xyz</query> </entry> <secondquery>abc_1</secondquery> <secondquery>abc_3</secondquery> <secondquery>abc_4</secondquery> </collection> So, the secondqueries are stored just after the entry they belong to. How would I be able to move these data from "right after a particular node" to "just inside this particular node" using XQuery Update? Thanks in advance and best regards Cerstin -- Dr. phil. Cerstin Mahlow Universität Basel Departement Sprach- und Literaturwissenschaften Fachbereich Deutsche Sprach- und Literaturwissenschaft Nadelberg 4 4051 Basel Schweiz Tel: +41 61 267 07 65 Fax: +41 61 267 34 40 Mail: cerstin.mahlow@unibas.ch Web: http://www.oldphras.net