[whatwg] xml:space

liorean liorean at gmail.com
Tue Jan 23 07:45:15 PST 2007

On 1/23/07, Henri Sivonen <hsivonen at iki.fi> wrote:
> On Jan 22, 2007, at 23:57, Ian Hickson wrote:
> > It's automatically conforming everywhere, no? Isn't it an XML thing?
> It is an XML thing. XML 1.0 4th ed. says:
> > A special attribute named xml:space may be attached to an element
> > to signal an intention that in that element, white space should be
> > preserved by applications. In valid documents, this attribute, like
> > any other, MUST be declared if it is used. When declared, it MUST
> > be given as an enumerated type whose values are one or both of
> > "default" and "preserve".
> http://www.w3.org/TR/REC-xml/#sec-white-space
> So the vocabularies that have a DTD and wish to use the attribute
> must declare it in the DTD. For DTDless vocabularies, it doesn't
> exactly say whether the vocabularies should explicitly allow the
> attribute, but explicitly allowing it leaves no ambiguity.

Well, considering the purpose of XHTML (main purpose is presentation
for humans, no?) is there any reason to NOT just set it to default to
"preserve" on the html element, fixed to "preserve" on the script,
style, pre and textarea elements and have it implied through an entity
for all other elements? Style sheets can change whether presentation
of whitespace is collapsed or not. By default, the whitespace is
collapsed but for the pre element it's conserved, but that can
overridden by user or author style sheets. But whitespace that is
structurally collapsed at the XML level cannot be restored for
presentation by the style sheet, so this whitespace is lost from ever
being presented as it appeared in the document.
David "liorean" Andersson

More information about the whatwg mailing list