Anne van Kesteren wrote:
Thomas Broyer wrote:
(or any element using the CSS "white-space" property)


That is purely for presentation. You should not use it if you need whitespace to be preserverd for semantics. (In such cases xml:space would probably be more appropriate...)

Right, but xml:space is applied to the XHTML "pre" element only when using a DTD (if not explicitly "instanciated" on the element, which is most likely not the case!).

<atom:content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml";>
<p>Hello World! in C#:</p>
<pre>
class Main {
    static public void main() {
        System.Console.WriteLine("Hello World!");
    }
}
</pre>
</div>
</atom:content>

Atom doesn't say how whitespace should be handled inside HTML or XHTML
content (text constructs or atom:content), nor inside extension elements.

Graham wrote:
On 18 Apr 2005, at 7:08 pm, Thomas Broyer wrote:
Duh! Why then is it described in
http://www.w3.org/TR/2004/REC-xml-20040204/#sec-white-space

It may be described there, but it doesn't do anything unless the vocabulary on top of HTML says it does.

It *does* something: it can force the application to preserve whitespace.

The XML vocabulary defines where it applies, and XHTML applies it on several elements, including "pre".

How are you supposed to write an HTML PRE (or any element using the
CSS "white-space" property) if the Atom processor collapses
whitespace?

The atom spec only references whitespace-collapsing in regards to type="text". It doesn't affect HTML.

But, as said above, it doesn't define the behavior for type="html" and type="xhtml", which means the Atom processor might collapse whitespace anywhere (including XHTML "pre" element and escaped-HTML content).


My feeling is that whitespace should be preserved (not collapsed) in content that will probably be passed to a secondary processor, that is XHTML and HTML, and other inline content in atom:content.
As all whitespace characters are passed from the XML processor to the Atom processor, at least the spec should inform implementors that whitespace SHOULD (at least, maybe MUST) be preserved (as it may be significant) if the content is not processed by the Atom processor (e.g. "direct output" inside an (X)HTML document in the case of a Web-based aggregator, or given as input to a third-party application/library).


Moreover, xml:space should be allowed on text constructs and atom:content (at least when type="text") with a default value (default to xml:space="default" for type="text") to allow content like:
...
<atom:title type="text">RELAX NG book at O'Reilly</atom:title>
<atom:summary type="text">
...
RELAX NG covers the following topics in depth:
- Introduction to RELAX NG
- Building RELAX NG schemas using XML syntax
- Building RELAX NG schemas using compact syntax, an alternative non-XML syntax
...
</atom:summary>


As extension elements are processed by the Atom processor and all whitespace is passed from the XML processor to the Atom processor, there's no need to define anything in the spec: Atom processors are responsible for handling extensions, thus whitespace collapsing/preserving of extension elements' content.

--
Thomas Broyer



Reply via email to