Question about @id validation in XHTML5

Hello,
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:
http://www.whatwg.org/specs/web-apps/current-work/#the-id-attribute
http://relaxng.org/compatibility.html#id
http://www.oasis-open.org/committees/relax-ng/xsd.html#IDAOGYR
http://www.w3.org/TR/xml-id/#with-relax-ng-validation

In the current Relax NG schemas, @id (and @xml:id) are defined in
http://syntax.whattf.org/relaxng/common.rnc

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

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.

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.
			</assert>
		</rule>
	</pattern>

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:
http://syntax.whattf.org/relaxng/tests/assertions/valid/001.xhtml

Best regards,
Alexandre Alapetite
http://alexandre.alapetite.fr

Received on Sunday, 16 November 2008 13:12:21 UTC