This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 23480 - Allow xml:id="Foo" (on the same conditions that xml:lang="Foo")
Summary: Allow xml:id="Foo" (on the same conditions that xml:lang="Foo")
Status: RESOLVED WONTFIX
Alias: None
Product: HTML WG
Classification: Unclassified
Component: HTML5 spec (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Edward O'Connor
QA Contact: HTML WG Bugzilla archive list
URL: http://htmlwg.org/heartbeat/WD-html5-...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-10 14:52 UTC by Leif Halvard Silli
Modified: 2013-10-21 17:30 UTC (History)
6 users (show)

See Also:


Attachments

Description Leif Halvard Silli 2013-10-10 14:52:36 UTC
PROPOSAL:

   For the HTML syntax, allow xml:id="foo" inside elements of any
   namespace, provided its value matchs an id="foo" attribute on same
   element.

   Alternatively, write an extension spec which permits xml:id.  If the
   editors don't want to include it in HTML5.x, I offer to write the
   spec.

JUSTIFICATION:

1) In XHTML 1.0 and XHTML 1.1, the @id attribut is, technically (due the
DTD), a tokenized XML attribute of type "ID".  As result, XPointer and
spec’s that implements XPointer, can be applied to XHTML 1.0 and XHTML
1.1 documents, provided that the XML tool chain supports DTDs.

2) HTML5 documents should have the same opportunity. For instance, the
XInclude 1.1. spec has just reached CR and it makes use of XPointer,
including the element(FOO) syntax, where FOO refers to an element of
ID-value 'FOO'. and XInclude. But, unless one uses one of the obsolete
but conforming DOCTYPE declarations that HTML5 permits, the @id attribut
does note work for xpointer usage.

(For XInclude 1.1, see
http://www.w3.org/TR/2013/CR-xinclude-11-20131008/ )

EFFECTS OF ALLOWING:

* xml:id (or more correctly, the ID content type, see XML 1.0
http://www.w3.org/TR/REC-xml/#id) is more restricted than the HTML5 @id
attribute with regard to content, since the xml:id attribute has some
validity constraints. Thus, when used, xml:id will impact on what is
poermitted inside @id (due to the requirement that xml:id and @id are
identical)

* The legacy XHTML 1.0 and XHTML 1.1 doctyps *cannot* be used, whenever
xml:id is used or else one would end up with documents where an element
could contain two attributes of type "ID".

NOT AFFECTED:

* Text/html browsers would not be affected as they do not support the
xml:id attribute. And even if they had supported it (like some legacy
Web browsers do when it comes to XML), it ought not to matter as long as
xml:id and @id are identical.

SUBOPTIMAL, ALTERNATIVE SOLUTIONS:

1) Instead of the most intutive variant of the element(FOO)
syntax, one can use another variant of its syntax. E.g. for
XInclude, one might to xpointer="element(/1/2/2)" - as opposed
to the more stable and more semantic xpointer="element(SemanticIDValue)". 

2) Or, instead of adding xml:lang="id", the author could somehow make
sure that the docs were consumed with a legacy DOCTYPE in place. But
this works against the trend of deprecating DOCTYPE declarations etc.

A USE CASE:

   ]]
   An author with a Web site which follows polyglot markup wants
to create a PDF output or some other single document output of all
the pages of the site. By the use of an XML toolchain that supports
XInclude, this is very simple. Just create a "parent" document which,
using the the <include> element of the XInclude specification, points to
all the documents that should be includled in the final output.

However, the author stumbles upon one problem: Since the HTML5 based
site contains navigation content etc on each page, he would like to use
XInclude’s XPointer support in order to point to the fragments which
should be included:

<include href="http://site.example.com/about.html"
xpointer="element(SectionFOO)" />

Alas, this does not work for the reasons described above. But there is
a simple solution: If the author, as needed, duplicates the current @id
attributes with an xml:id attribute, it would work: Just convert <foo
id="bar"> to <foo id="bar" xml:id="bar"> through out the document.
   [[
Comment 1 Henri Sivonen 2013-10-17 13:03:44 UTC
I'm strongly opposed to this. xml:id has a high implementation cost--both in browsers and in other apps. I think the HTML spec should avoid any appearance of suggesting that using xml:id  or implementing xml:id  might be a good idea. (I have actually implemented xml:id in a non-browser app, so I have some implementation experience.)

Also, use case starts with "An author with a Web site which follows polyglot markup"... Sigh.

Please WONTFIX.
Comment 2 Leif Halvard Silli 2013-10-17 14:00:00 UTC
(In reply to Henri Sivonen from comment #1)
> I'm strongly opposed to this. xml:id has a high implementation cost--both in
> browsers and in other apps.

Let me just point out that

1) The use case si implementations/apps that (already) support XInclude.
2) Browsers do not support XInclude and are as such not the target.
3) Per what the W3C’ NU validator accepts, the W3C community already accepts many things in HTML5 that browsers do not support, for instance RDFa.

I agree that, given for instance the precedence of RDFa, xml:id should perhaps rather be specced in a separate spec. However, I thought it good to start here.

> I think the HTML spec should avoid any
> appearance of suggesting that using xml:id  or implementing xml:id  might be
> a good idea. (I have actually implemented xml:id in a non-browser app, so I
> have some implementation experience.)

I “can live with” speccing it in a separate spec. That should be clear from the initial comment.

> Also, use case starts with "An author with a Web site which follows polyglot
> markup"... Sigh.

And the trouble is?

> Please WONTFIX.

Is WONTFIX the right resolution if it is going into a separate spec? Just asking.
Comment 3 Leif Halvard Silli 2013-10-17 15:07:44 UTC
(In reply to Henri Sivonen from comment #1)

> Also, use case starts with "An author with a Web site which follows polyglot
> markup"... Sigh.

Perhaps enlighten the discussion to point out the folloing:

1) The <include> element in the XInclude namespace is able to tell the XML parser to parse the included HTML document as (some flavor of) XML. As such, parsing an text/html document as XML is perfectly possible from XInclude’s point of view. (It took me some years to understand that XInclude  behaves that way …) However, the included document got to be both wellformed and in the XHTML namespace. 

2) The included document must be in the XHTML namesapace, if you want to keep the formatting.

Thus, using poyglot markup makes some sense.
Comment 4 Edward O'Connor 2013-10-21 17:30:05 UTC
EDITOR'S RESPONSE: This is an Editor's Response to your comment. If you are
satisfied with this response, please change the state of this bug to CLOSED. If
you have additional information and would like the Editor to reconsider, please
reopen this bug. If you would like to escalate the issue to the full HTML
Working Group, please add the TrackerRequest keyword to this bug, and suggest
title and text for the Tracker Issue; or you may create a Tracker Issue
yourself, if you are able to do so. For more details, see this document:

   http://dev.w3.org/html5/decision-policy/decision-policy.html

Status: Rejected
Change Description: No change.
Rationale: I concur with Henri's reasoning in comment 1.