Hi Kevin,
Oh, I think I may have found the answer... it seems I want the 'raw' serializer instead of the text one. That will output <, >, etc. without escaping it. I should be able to serialize the xml to string, double-quote the single quotes, and then write to file using 'raw'...
yes, you were faster.. Those two examples should give you the expected result:
file:write('test1', '<x/>', map { 'format':='no' }) file:write('test2', '<x/>', map { 'method':='raw' })
Both serialization parameters are BaseX-specific [1], as the official standard doesn't offer any help here.. Christian