Properly escape backtrace attributes to avoid invalid XML