>> > Well, generally storing data in attributes should be avoided:
You haven't backuped your statement by any arguments
:-) You have asked how to aggregate string -- I've answered you how to do it by one statement without needs to write any of PL/pgSQL code. So the string aggregation problem is solved. ;-)
This list is not correct place to discuss XML. My only argument is a common sense. You don't make difference between the data and attributes. The data of <pref_money> is obviously money amount and the date is obviously its attribute: <user id="id"> <pref_money date="2010-..">money_value</pref_money> ... </user>
PS. If you don't want to follow this way you can "reduce" the size of XML transfer by placing all the data in one tag: <user id="id" prefmoneydate="2010-.." prefmoneyvalue="..."/> ...