Re: Validator fails on PHP instructions inside attribute values

Dag-Erling Smørgrav wrote:

 > Feel free to write one (it should only take a few lines of Perl) and run
 > it on your code before submitting it to the validator, but it's not
 > really a good idea, because the code you validate will not be the same
 > as what the user's browser sees.

I think there is a better solution : write a custom DTD that
extends the DOCTYPE against which you are trying to validate
by making all well-formed constructs of the form

 <?php echo $clang;?>

legal within attribute values and anywhere else that you
wish to use them but which do not satisfy the formal
requirements for a Processing Instruction (PI), then
validate against that DTD.

Philip Taylor

Received on Tuesday, 20 July 2010 16:48:25 UTC