Re: ID Characters (was: Re: 3.4. Global attributes)

On Wed, 01 Aug 2007 17:18:42 +0200, Robert Burns <rob@robburns.com> wrote:
> "The value must be unique in the subtree within which the element finds  
> itself and must contain at least one character."
>
> I'm not sure I understand what this means, but it sounds to me like @id  
> attributes need only be unique within a particular node (or within a  
> depth traversal of a node)?

It would be good if subtree were defined. I think it is meant (besides  
document uniqueness) to also cover cases like DocumentFragment, etc.


> "This specification doesn't preclude an element having multiple IDs, if  
> other mechanisms (e.g. DOM Core methods) can set an element's ID in a  
> way that doesn't conflict with the id attribute."
>
> Again, I don't really understand what this paragraph is saying. Is this  
> multiple attributes with different names all taking a value of type ID?

It is about multiple _attributes_ of type ID. For instance:

   <div id="foo" xml:id="bar">

(Although it seems that implementations are leaning towards not supporting  
multiple attributes of type ID at all for performance reasons. (See the  
Gecko bug on xml:id for more information.))


> Also, what are the use-cases this is trying to address. Why would we  
> need to have multiple @id attributes on the same element?

It's there to clarify that the specification does not forbid xml:id if I  
remember correctly.


> I don't think this really is related to DTD or RelaxNG or XSD, etc.  
> However, I look at the HTML4 recommendation and the XML 1 recommendation  
> and we do not appear to fit in with respect to ID. That doesn't sound  
> like a good thing (in terms of document conformance).

That's because the HTML4 and XML attributes of type ID are based on DTDs,  
as Henri explained. We're not constrained by that.


-- 
Anne van Kesteren
<http://annevankesteren.nl/>
<http://www.opera.com/>

Received on Wednesday, 1 August 2007 15:33:02 UTC