I started to quip, “better to use a better templating system!” But of course you can’t realistically do that. An “XML Lint” tool is certainly a good tool to have handy, because tpyos always come in piars.
The “teddy bear technique” quote, linked-to in the above comment, says in part: Talk your problems out with a silent but sympathetic listener and the answers will often spring full blown (or nearly so) as if from (someone’s) forehead. Neglecting to further mention that a good slap on the aforesaid forehead ... Doh!!™ ... also is known to be very beneficial in such cases. (Go ahead... click the hyperlink... enjoy.)