W3C home > Mailing lists > Public > www-html-editor@w3.org > April to June 2005

Other Problems with HTML and XHTML Frequently Answered Questions

From: Collin Hsu <collin@w3china.org>
Date: Sun, 22 May 2005 22:57:26 +0800
To: <www-html-editor@w3.org>
Message-ID: <E1DZrtY-00061v-I8@lisa.w3.org>



Why is xml:space set to 'preserve' on all elements of XHTML? I don't want to
see extra space in my output.

The attribute xml:space is about input: that is to say, it controls if the
spaces will be present in the DOM (i.e. in the internal version of the
document inside the browser); it says nothing about what will appear on your
screen. Output whitespace is controlled by the CSS property 'whitespace'.
Set it to 'pre' and the spaces in the DOM will be preserved on output; set
it to 'normal' and the whitespace will be collapsed (CSS3 will have more
properties to enable greater control).

This is the reason that all elements are set to xml:space="preserve" in
XHTML2, otherwise the CSS 'whitespace' property would have no effect, and
you would have no control over visible whitespace. The default stylesheet
will set 'whitespace' to 'normal' for all elements except <pre>, but you
will be free to change them.


I think it would be more accurate if the "XHTML" in the title is replaced
with "XHTML 2".


I notice in the FAQ sometimes it is written as "XHTML2" and sometimes "XHTML
2".  Is it possible that they are unified to be "XHTML 2"(probably more
formal than "XHTML2")?

Received on Sunday, 22 May 2005 14:57:40 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:08:54 UTC