Henri Sivonen <hs******@iki.fi> wrote:
<pre><a><img src="image.png" alt="" /></a></pre>
validates as XHTML 1.0 Strict whereas
<pre><a><img src="image.png" alt=""></a></pre>
does not validate as HTML 4.01 Strict, when I used
http://validator.w3.org/ for validation.
XML DTDs are more limited in their expressiveness. The inability to
express exclusions like that is one of the limitations.
The XHTML 1.0 DTD tries to overcome the limitation by using a special
content model for the <pre> element:
<!-- pre uses %Inline excluding big, small, sup or sup -->
<!ENTITY % pre.content
"(#PCDATA | a | %fontstyle; | %phrase; | %special.pre; | %misc.inline;
| %inline.forms;)*">
This won't make <pre><a><img src="image.png" alt=""></a></pre> invalid,
though, since the rules are satisfied: <pre> contains just the <a> element,
which is allowed of course, and the content model of <a> allows any inline
content, including <img>.
It would be possible, but highly impractical, to write XML syntax rules in
a manner that corresponds to the HTML rules for <pre>. You would
essentially have to duplicate a large number of syntax rules, having both
"general version" and "pre version". Besides, the whole point in those
<pre> rules is questionable. The intent is to disallow markup that might
cause font size to change or might introduce anything that is not
representable as a "character cell". Yet, allowing e.g. form fields inside
<pre> works against this idea, and sounds rather pointless.
--
Yucca,
http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring:
http://www.cs.tut.fi/~jkorpela/www.html