This is probably easy, but I can't find an inbuilt method or function to do this easily. I have a function that will return certain nodes from a DB. The DB was built with CHOP off - plenty of white-space present between nodes. declare function dq:errorGivenName($db as xs:string) as element()* { db:open(concat($db, '_author))/*/*[matches(givenname, "[^\p{L}\p{M}-[\s-'''\.]]")] }; I can't predict where the function will be called so I've got no control over serialization parameters. Instead I'd like to pretty print the XML fragment returned by the function. I could write something to do this, but there must be a simple way ... right? C. ________________________________ Elsevier B.V. Registered Office: Radarweg 29, 1043 NX Amsterdam, The Netherlands, Registration No. 33156677, Registered in The Netherlands.