W3C home > Mailing lists > Public > public-html@w3.org > November 2008

Question about @id validation in XHTML5

From: Alexandre Alapetite <alexandre@alapetite.net>
Date: Sun, 16 Nov 2008 14:11:44 +0100
Message-ID: <42a8e2e00811160511j2b2995b0wdb722995a114f3a4@mail.gmail.com>
To: public-html@w3.org

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), 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.

I have read for instance:

In the current Relax NG schemas, @id (and @xml:id) are defined in

	common.attrs.id =
		attribute id {
	common.attrs.xml-id =
		attribute xml:id {
		} & XMLonly
	common.data.id =
#		xsd:string {
#			pattern = "\S+"
#		}
	common.data.name =

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

Here comes my problem: In the Schematron schema
http://syntax.whattf.org/relaxng/assertions.sch there are some rules
making use of the XPath id() function. How does my general XSL
processor (which I use for Schematron) should be informed that
(X)HTML5's @id is an ID that can be used for the id() function?

	<pattern name='contextmenu must refer to a menu'>
		<rule context='h:*[@contextmenu]'>
			<assert test='id(@contextmenu)/self::h:menu'>
				The &#x201C;contextmenu&#x201D; attribute must refer to a
				&#x201C;menu&#x201D; element.

This could of course be rewritten to void the use of the id()
function. Or, would it be better to rewrite those rules avoiding the
@id() function?

Here is an example of valid XHTML5 document that my validator (written
in C#.NET) currently reports as erroneous due to this issue:

Best regards,
Alexandre Alapetite
Received on Sunday, 16 November 2008 13:12:21 UTC

This archive was generated by hypermail 2.3.1 : Thursday, 29 October 2015 10:15:39 UTC