You will need to give us a lot more information before we can even start to help you. What is the ditto call, the template(s), what is the page type, do you have phx installed, if you manually correct the file does it validate, do you serve the file as xml or kml?
The ditto call may seam unimportant, but in order for us to help you having all of the fact makes a huge difference. If you could share all of the code on the page and the ditto template we can give you some help. There isn't much we can do without the code you are trying to use.
I just tested that on one of my sites and the tag retains it's cases as expected.
Do you have any plugins installed that might be responsible? Something that enforces an xhtml strict format?