Re: PHP code only allowed in XHTML 5?

Nick Fitzsimons On 09-07-22 18.12:

> 2009/7/22 Leif Halvard Silli <lhs@malform.no>:
>> If the coding style is to produce valid PIs, then it is a disservice to
>> prevent validation.
>>
> 
> As has already been pointed out, a construct such as
> 
> <p class="<?php echo 'foo' ?>"></p>
> 
> is perfectly OK as far as PHP is concerned, but is not well-formed
> XML (and I believe not well-formed SGML either),  as the "<" character
> (and therefore a PI) cannot appear at that position [1].


It validates as HTML.

> So even if
> PIs were added to the spec, PHP developers would still have every
> chance of getting validation errors.


Of course. No one claimed otherwise.

> Thus there seems to be little
> point in adding PIs to the spec, as doing so won't even solve the
> supposed problem that makes you wish to see them included.

I can inform you that you are wrong.

> Note that HTML 4.01 did not include PIs as one if the "SGML Constructs
> Used in HTML" [2], but relegated them to an appendix as something that
> "should not be used" [3].


Gee, suddenly interpreting the HTML 4 spec became of interest ... 
Let's jump right on to Section B.3.6 which explains processing 
instructions - it ends like this[1]:

   Authors should be aware that many user agents render
   processing instructions as part of the document's text.

However, this information completely outdated, as as both mayor 
and minor User Agents supports the HTML 4 style of processing 
instructions in that they are completely ignored (although UA 
differs a little about how to render them in the DOM).

Others of those warnings are also outdated. For instance, it says 
that UAs may only support <option selected> and not <option 
selected="selected">. But at least Validator.nu doesn't seem to 
agree with this, as it allows both syntaxes.

> So it's not as if there's ever been any
> reason to expect an HTML validator to handle them even when they are
> situated in a valid location within the document.


As a matter of fact, the not so ".nu" validators do handle PI 
validation.

 
> [1] <http://www.w3.org/TR/2008/REC-xml-20081126/#CleanAttrVals>
> [2] <http://www.w3.org/TR/html401/intro/sgmltut.html#h-3.2>
> [3] <http://www.w3.org/TR/html401/appendix/notes.html#sgmlfeatures>

[1] http://www.w3.org/TR/html401/appendix/notes#h-B.3.6
-- 
leif havlard silli

Received on Wednesday, 22 July 2009 22:10:05 UTC