Are single quotes valid around tag attributes in XHTML?  I skimmed over the
W3C XHTML 1.0 spec before posting the previous message and got the
impression all attributes had to be double quoted.  It would be great if
single quotes were valid, since I've fallen into the habit of using
them for the same exact reason this thread got started... easier to read and
faster to type than \" :)

Oops, and shame on me - tag and attribute names in my previous code snippets
should all be lower case,
too, IE:

echo "<option value=\"$option_value\">$option_text</option>\n";

Of course, a page will render just fine in any modern browser whether tag
attribute values are single or double quoted (or in most cases, even if
they're not quoted at all.)  But if everyone got in the habit of adhering to
standards, and browsers implemented standards correctly (without extending
them with propietary junk), what a nice world it would be. Oh, and world
peace would be great too. :P

Of course, I'm just as guilty of lax coding.  The next time I begin a site
from scratch my plan is to use PSGML mode in emacs, and edit against the
XHTML 1.0 DTD.  Strict? Yes, but clean and compliant :)  (And PSGML does
great code formatting as you go.)

-Andy


> Unfortunately, if you want to maintain XHTML
> : compliance the tag attributes have to be double-quoted too...
> :
> : echo "<OPTION VALUE=\"$option_value\">$option_text</OPTION>\n";
>
> Why stick with quotation marks?
>
>       echo "<OPTION VALUE='$option_value'>$option_text</OPTION>\n";>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to