Encode and decode as needed so we don't write invalid XML, define a var.

This might not be necessary, the browser may decode for viewing.