ID attribute defaults

John E. Simpson simpson at
Wed Nov 11 19:43:31 GMT 1998

I understand why IDs don't typically have defaults, each one required to be

OTOH, what about a data-based (not database-based) XML app whose content
model, especially at the top of the tree, consists largely of elements
which may occur only once in an entire document instance? It seems to me
that there's still potential value in assigning such elements a fixed
"default" value -- primarily for purposes of internal cross-references.

Tim Bray's annotated XML spec says (in the annotaton on production [56]
regarding the IDREF validity constraint), "In general, it's a good idea to
attach ID attributes to as many elements as possible in every document,
because, later, if you decide you need to point at anything, you'll be
happy if it has an ID attribute ready for use." Agreed. 

Later, in the discussion of the #FIXED attribute type (prod. [60]), he says: 

    ....suppose, for example, that I insert a pointer here to 
    my favorite piece of the XML spec. When I do this, I use an 
    element named Sref (for Spec-ref), which becomes an A 
    element in the HTML version. However, in all cases, I want 
    that pointer to get another attribute target='spec'", so 
    that when you use it, it takes effect in the left-hand frame, 
    which is named spec.

    So that I don't have to enter that attribute in each Sref 
    element, the internal subset contains this:

       <!ATTLIST Sref target CDATA #FIXED "spec">

This is exactly what I'd like to do. But this seems like something of a
gimmick to reproduce the effect of the ID/IDREF attribute types, one which
furthermore requires an app to interpret -- not leveraging the built-in
cross-reference facility.

What am I missing? Is there some way both to use ID/IDREF *and* not require
the document author to supply IDs on her own?

Thanks for any brainstorms,
John E. Simpson

John E. Simpson            | It's no disgrace t'be poor,
simpson at        | but it might as well be.      |            -- "Kin" Hubbard

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at
Archived as:
To (un)subscribe, mailto:majordomo at the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at

More information about the Xml-dev mailing list