Re: PHP code only allowed in XHTML 5?

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]. So even if
PIs were added to the spec, PHP developers would still have every
chance of getting validation errors. 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.

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]. 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.

[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>

Regards,

Nick.
-- 
Nick Fitzsimons
http://www.nickfitz.co.uk/

Received on Wednesday, 22 July 2009 16:13:34 UTC