Mike: Thanks for looking into it. Glad to know I didn't miss something terribly obvious.
re: "replace required on certain characters. "
I would add: & # x 0 D ;
as characters that may need replacing.
(without the spaces. I can't figure out how to get this to display as-is. What did you do to get the above encodings to appear as-is?)