- From: Ian Hickson <ian@hixie.ch>
- Date: Thu, 27 Jan 2005 17:33:22 +0000 (UTC)
- To: Norman Walsh <Norman.Walsh@Sun.COM>
- Cc: public-xml-id@w3.org
On Thu, 27 Jan 2005, Norman Walsh wrote: > > ID assignment "is often achieved by promoting the type of an untyped > element or attribute value to a value of type ID". Attributes named > xml:id are going to be turned into attributes of type ID. This is done > without regard to the validity of the attribute value, per the Infoset: I'm not debating whether invalid IDs should be used for ID assignment, only that empty IDs should not. > The empty string is not treated as a special case In many current implementations (which are not implementations of the Infoset but only of XML and the DOM, for instance), as well as in other languages (for example CSS), an empty string cannot be an ID. In xml:id, it can be (indeed, must be). > In this document: > > <!DOCTYPE doc [ > <!ATTLIST doc xml:id ID #IMPLIED> > ]> > <doc xml:id=""/> > > The 'doc' element has an 'id' attribute with an [attribute type] of ID > and a [normalized value] of "". The xml:id specification will provide > identical semantics for this document: > > <doc xml:id=""/> > > which is the entire point of the specification. ...but it won't, for example, have the same semantics as: <p xmlns="http://www.w3.org/1999/xhtml" id=""/> ...which, in most XHTML+DOM implementations, does not have an ID. > I observe that (1) no existing documents legitimately use xml:id > attributes, (2) there is not now, nor does the xml:id specification > provide, any authorized interpretation of xml:id attributes as anything > other than an ID. It follows that no one should ever use xml:id="" in a > document because it is manifestly wrong. Whether it is allowed or not is largely irrelevant to the majority of Web authors, unfortunately. When an element's ID is used in some way, if it is empty, problems will result (e.g. because scripts compare IDs to the empty string to establish if an element has an ID, or because a language in which the ID is inserted doesn't support empty IDs, etc). It would be easy to side-step all these problems by simply saying that an xml:id attribute that normalises to nothing does not cause the UA to assign an ID to the element. -- Ian Hickson U+1047E )\._.,--....,'``. fL http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,. Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
Received on Thursday, 27 January 2005 17:33:26 UTC