W3bbo wrote:
Sven Groot wrote: Yes, I know. But just as you can put the selected attribute anywhere you can also put the / attribute anywhere. But in XHTML the / is only valid at the end of the tag.
Well not strictly speaking, no.
In XHTML, the "/>" is treated as a single node component, the "element delimiter", thus, a good parser would process the standalone "/" as a null attribute, maybe throw an XML warning, but otherwise ignore it.
But yes, in a way the "/" is only really valid at the end of the element delimiter.
Although according to the rules of SGML and XML, an DTD attribute with a name containing "/" is valid, but it would confuse a lot of people
But attributes without value aren't allowed, so you'd still need to put /="something". A lonely slash can only occur at the end of the element tag, or at the beginning or an end element.
EDIT: MSXML at least doesn't allow an attribute named '/':
The character '>' was expected. Error processing resource 'file:///C:/Documents and Settings/Sven Groot/Desktop/test.xml'. ...
<test /="hello" whatever="something">Hello there</test> -------^