Hello CHristian, Thank you for help. Understood. Structure <rest:response> was serialized to empty string. Now It is clear for me why data is lost. Best Regards Bogdan Bogucki Od: Christian Grün [mailto:christian.gruen@gmail.com] Wysłano: 14 lipca 2018 13:25 Do: Bogdan Bogucki DW: BaseX Temat: Re: [basex-talk] <rest:response> - unclear strategy of setting header during serialization If you change the return type of an XQuery function to xs:string, your nodes will be implicitly converted to strings. This is the standard behavior of XQuery and no particular feature of RESTXQ. Play around with the query that I presented in my previous answer. You need to remove the xs:string* return typeb you can replace it with item()*.