If you are generating XML (which is what XHTML is) then you have no way of controlling how empty elements are rendered in the output, and it shouldn't make any difference anyway.
So if it does make a difference (and from what you say, it does) then it looks to me like the browser isn't treating your output as XHTML, but just as HTML. Perhaps
you should investigate why that is.