Re: Options for dealing with IDs

Hi Chris,

> If I have omitted a solution, or omitted significant advantages or
> disadvantages, I would be glad to hear them.

You missed the option:

  Add an inline, per subtree multiple ID declaration method
  In the same way that xml:base added a predeclared attribute to the
  existing xml:lang and xml:space attributes, add another one called
  xml:idAttrs. It takes as value a whitespace-separated list of the
  local names of attributes. All attributes with one of those names in
  the per-element partition, on that element and its children become
  of type ID. It can be used on any element. It can also take the
  value "" in which case, no attributes on that element or its
  children are declared to be of type ID (used when composing multiple
  namespaces). An xml:idAttrs on a child completely overrides that on
  its parent.

Say you had:

  <foo>
    <bar id="fred" />
    <baz ID="barney" />
  </foo>

and both id and ID are IDs. With xml:idAttr you could do:

  <foo xml:idAttr="id">
    <bar id="fred" />
    <baz xml:idAttr="ID" ID="barney" />
  </foo>

As I understand it, if <baz> had an id attribute then that would also
be counted as an ID. Is that correct, or is your intention that there
is only ever be one attribute in scope as an ID attribute at any one
time?

xml:idAttrs would allow multiple attributes to be labelled as ID
attributes; in this example you could do:

  <foo xml:idAttrs="id ID">
    <bar id="fred" />
    <baz ID="barney" />
  </foo>

I'm not sure this would be my favoured option, but I think it should
be added for completeness. It has the advantage that it makes altering
documents with mixed namespaces (and with different names for ID
attributes in those namespaces) easier than xml:idAttr.
  
Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/

Received on Friday, 10 January 2003 10:45:00 UTC