Yes XML is certainly turning out to be a pain. I did try the <![CDATA[ and ]]> thing wrapping the content of the <details>
XML tag in that but it did not work giving the same problem.
Still this solution seems to work OK for now and therefore I will run with it for now. Many thanks for your help on this matter, it is much appreciated.