Re: XML:ID extension spec proposal to HTML5 documents

David Carlisle, Wed, 05 Feb 2014 09:39:59 +0000:
> On 05/02/2014 06:36, Leif Halvard Silli wrote:
>> Btw: If instead of a xml:id, one made a XHTML5 DTD that took care of
>>  the ID type assignment, then we would avoid becoming valid in HTML
>> (on one side), yet still be back-compatible with legacy XML tools
>> (on the other side).
> 
> Any of the "legacy" DTD allowed by HTML5 will do that already for
> existing HTML4 elements. That would cover the vast majority of documents
> that you want to id.

Yes, but if one includes the new elements in a document with legacy DTD 
doctypes, xinclude stops working … (Claim based on xmllint and prince 
xml - I think both use the same libxml .)

But here is an interesting hack, only for XHTML:

<!DOCTYPE html 
[
 <!ELEMENT article (#PCDATA)*>
 <!ATTLIST article id ID #IMPLIED>
]>

That’s all that’s xinclude requires if one wants to include article 
elements, for instance. (Again, based on xmllint and prince XML.)

If the files risk leaking out into the open, so that one and wants to 
prevent HTML parsers from landing in quirks mode, one can polyfill the 
doctype something like this:

<!DOCTYPE html SYSTEM "about:legacy-compat" 
[
 <!ELEMENT article (#PCDATA)*>
 <!ATTLIST article id ID #IMPLIED>
 <?parserhack ]><!--?>
]>
<!--?!-->

> It's unfortunate that there isn't a Public identifier for a sane
> non-legacy DTD (but as you know there is an extension spec for that)

The above hints to me that the DTD we are looking for *just* to assign 
ID to id, ought to be pretty simple. We don’t need a complete DTD. We 
only need something that assigns ID to id. The named entities would of 
course also be nice to have, though.

> but whatever identifier you use then it's fairly trivial to have a
> catalog ad a local DTD that declares any id attributes you need to be of
> type ID when used with an XML parser.

Is this a simple as configuring a Web server? ;-) Seriously, I’d love 
to be able to do this. But I am at loss w.r.t. to how to set it up. 
Examples would be fine.

> So I don't see any need to use xml:id.

The ID assignment is useful. 

> In fact I'd go further and say
> that xml:id was a well intentioned idea but it causes more problems than
> it solves on the XML side (there is basically no resolution to the
> problem that it clashes with DTD defined ID) (We looked at using it with
> MathML for example and there was no basically way to make it work given
> that we had an existing id attribute). Given that I view xml:id as a
> failed experiment for XML I can't see how I could support inflicting the
> same problems on HTML.

The problem basically is, I suppose, that there is only meant to be one 
ID attribute per element.
-- 
Leif Halvard Silli

Received on Wednesday, 5 February 2014 15:21:54 UTC