Why Does "xml:space" Exist?

xml:space exists because the XML WG was influenced by the very handy <PRE> element in HTML. This tells the HTML processor not to chew up any of the white space, but to leave it as-is (it normally also has the side-effect of causing the content to be rendered in a monospace font).

Which is a useful capability, and so XML got the xml:space attribute.

xml:space Has No Required Effect

That is to say, the existence of this attribute has no effect whatsoever on the required behavior of XML processors or applications. It is simply a convention that authors can use to pass a message along to whoever's downstream, requesting that the white space in some element be preserved.

Back-link to spec

Copyright © 1998, Tim Bray. All rights reserved.