Re: Question about @id validation in XHTML5

On Nov 16, 2008, at 15:11, Alexandre Alapetite wrote:

> I am in the process of adding XHTML5 to a little general XML
> validator. While I am not done with the HTML5 datatype provider (C#,
> to be Open Source),

Cool. Do you mean you intend to implement the http://hsivonen.iki.fi/html5-datatypes/ 
  in C#?

> everything went smooth, except an issue with the
> validation of the @id attributes, for which I wonder how the
> underlying XML/XSL/XPath processors are informed that XHTML5's @id is
> an ID.

You need to have an "XHTML5 id processor" between the XML parser and  
the XPath engine. This layer is analogous to the xml:id processor  
defined in the xml:id spec.

The Java SAX implementation that I use is
http://about.validator.nu/apidoc/src-html/nu/validator/xml/IdFilter.html

Note that I'm seriously considering removing xml:id support, because  
xml:id has failed to become a part of the Web platform and has turned  
out to be troublesome and unnecessary. (WebKit decided against xml:id  
support. Adding support for Gecko was attempted, it was non-trivial  
and was pulled due to performance problems that it caused. Using Gecko  
and Validator.nu as data points, xml:id has turned out to be more  
trouble than it's worth.)

> There does not seem to be a rule specifying that @id is an ID, which
> can be understood by a general (i.e. not specially made for (X)HTML5)
> processor. The fact that w:ID can also be used for @name without error
> illustrates that there is no information regarding the uniqueness of
> @id.

Indeed, w:ID deliberately doesn't participate in RELAX NG DTD  
Compatibility IDREF checking.

-- 
Henri Sivonen
hsivonen@iki.fi
http://hsivonen.iki.fi/

Received on Sunday, 16 November 2008 13:48:48 UTC