[whatwg] id and xml:id

Robin Berjon robin.berjon at expway.fr
Wed Apr 12 12:02:48 PDT 2006

On Apr 12, 2006, at 14:25, Henri Sivonen wrote:
> On Apr 4, 2006, at 19:35, fantasai wrote:
>> That seems odd. You should be able to say "the content model of  
>> this element
>> is anything".
>> http://books.xmlschemata.org/relaxng/relax-CHP-12- 
>> SECT-2.html#relax-CHP-12-SECT-2.1
> From the spec:
> "Thus, a RELAX NG schema that is compatible with this feature  
> implies a mapping from element/attribute name pairs onto an ID- 
> type, and hence a mapping from attributes in the instance onto ID- 
> types."
> ( http://relaxng.org/compatibility-20011203.html )
> "Any attribute" with ID-type null on "any element" competes with  
> attribute id with ID-type ID on element foo. That's why the  
> attributes with non-null ID-type would paired with known elements  
> need to be subtracted from the "any" set.

Yes, that's is IMHO the single biggest PITA with RNG. I wish that  
restriction were removed but it seems unlikely. For the SVG Tiny 1.2  
RNG I worked around this by having a schema that never mentions the  
fact that you can have anything from foreign namespaces and using  
NVDL to express the way in which vocabularies could be mixed. You can  
look at it at http://www.w3.org/TR/SVGMobile12/ 

> I think that a conformance checker / schema should forbid element  
> children of <style> and <script> when the style sheet language or  
> script language is known to be text that is passed to a non-XML  
> parser for further processing. I'd worry about designing schemas  
> that allow element children there only when someone actually  
> develops an XML-based scripting or style language that is would  
> otherwise be suitable for embedding in XHTML <style> or <script>. I  
> don't see why a conformance checker or a schema should be open- 
> ended and have an "anything goes" hole here--especially if the  
> schemas are available for modification by prospective developers of  
> such script or style languages.

Using NVDL you could say in the RNG "the content of this is text" and  
then mix in XML styling or scripting languages without touching the  
RNG, only changing the NVDL driver.

>>> 2) Jing complains about the IDREFness altering co-occurrence   
>>> constraint between valuetype and value on the param element.
>> >
>>> 3) It appears that in RELAX NG an attribute can't be allowed to  
>>> take  the empty string if the attribute has the IDREFS nature.  
>>> This is a  problem with the form attribute.
>>> See: http://groups.yahoo.com/group/rng-users/message/422
>> Does moving the choice up higher help any?
> According to the spec it should not help. I also tested moving the  
> choice up in the latter case and, indeed, it did not help.

If using DTD-compatibility types causes too many problems (as seems  
to be the case) then it might be a good idea to drop it and use  
embedded Schematron rules to check the same constraints but without  
the caveats.

Robin Berjon
    Senior Research Scientist
    Expway, http://expway.com/

More information about the whatwg mailing list