[whatwg] [WF2] Web Forms 2.0: Repetition and type ID

fantasai fantasai.lists at inkedblade.net
Mon Jul 4 08:41:36 PDT 2005


Ian Hickson wrote:
> On Mon, 4 Jul 2005, Robin Berjon wrote:
> 
>>>[things that it is likely schema systems can't check:]
>>> * checking the MIME type of the file
>>> * there must not be more than one <dfn> per term
>>> * some of the more exotic content models, e.g. <ins>, <del>, the
>>>distinction between inline-level containers and block-level containers
>>> * checking conformance of <meta> elements (requires parsing a profile)
>>>
>>>...and of course:
>>>
>>> * IDs may contain any characters, not just those allowed in XML IDs.
>>
>>Amongst the tools that have been mentionned was Schematron. Out of the 
>>box Schematron can't check a media type, but with a very trivial to 
>>write extension function it could. All the rest that you mention seems 
>>very much doable. Schematron is built on XPath, which is a very useful 
>>and powerful little language.
> 
> Cool. In that case I look forward to a Schematron HTML5 conformance 
> checker.

What would be more practical, and I think Henri will agree with this,
would be a RelaxNG schema with embedded Schematron to handle what the
RelaxNG grammar cannot. Schematron is very powerful, but this comes
at the cost of usability. A full Schematron schema for HTML 5 would
be, I suspect, an unecessarily painful project. It would also not be
useful for anything besides conformance-checking. (Schematron is a
rule-based schema language, as opposed to a grammar-based one. You
basically write a lot of asserts against XPath expressions.) Grammar-
based schemas like RelaxNG are easier to use for other things (like
guiding the editing process).

> Just out of interest, how would you do the second one above? Making sure 
> that in any one document, there is only one <dfn> for each term defined? 

I'm no XPath expert, but basically, if you can write an XPath expression
that returns true when there's more than one <dfn> element with the same
term, then you can write a Schematron rule that checks for this.

> The relevant part of the spec being:
> 
...
> | There must only be one dfn element per document for each term defined 
> | (i.e. there must not be any duplicate terms). 
> 
> It's simple to implement that in, e.g., a dedicated perl-based conformance 
> checker, but I have no idea how you'd do that in Schematron.

Now my question is, what if you need to define the same term twice?
E.g.
   In CSS, a <dfn>property</dfn> is ...
   However, in XXX, a <dfn>property</dfn> is ...

>>>>Generic XML editors like XXE have support for using a schema to 
>>>>guide the editing process, but have no knowledge specific to a given 
>>>>language like XHTML. These tools, and other generic XML tools, will 
>>>>not be able to recognize the IDness of the 'id' attribute if it's 
>>>>not possible to express this in a schema.
>>>
>>>As mentioned, that will be the least of their problems.
>>
>>No, fantasai is right, I can see this being a FAQ, for no obvious 
>>technical reason.
> 
> You seriously think that nested templates will be common enough for this 
> to be a FAQ? Wow. A few months ago people were saying that this would be 
> so rarely used that we should take it out!

No, Ian, the frequency of templating IDs is irrelevant here. What is
relevant is that if you don't have an ID-compliant syntax for templating
IDs, and the spec expects that such templating nonetheless be possible,
then you can't have a schema that types the 'id' attribute as ID. The FAQ
would be "Why aren't id attributes typed as ID in the DTD/schema so that
XXX works properly?" and the answer would be "Because we need to allow
these non-ID chars in the 'id' attribute so that templating is validly
possible."

~fantasai



More information about the whatwg mailing list