[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Inheritance/defaulting of attributes
Inheritance/defaulting of attributes is a quite common thing in SGML (and so presumably it will be common in XML). In fact, it's common enough that a lot of people wish that SGML offered an attribute default value of #INHERITED, as a more specific form of #IMPLIED. In some DTDs, I've defined a parameter entity %inherited; that resolves to #IMPLIED, as a kind of self-documentation of intent. I think it might get a little tricky, though, to nail down precisely what the defaulting behavior should be if it's formalized in XML. When you inherit a value from an ancestor, the attribute name is assumed the same across both element types. But should they have the same declared and default types? Is it an error if they don't? In fact, what this comes down to is needing some sort of agreement over what attributes are "the same," even though they're on different element types. (Hmm, a subject that has been broached in the namespace discussion on the SIG list recently...) Eve At 04:35 PM 10/4/97 -0400, Peter Murray-Rust wrote: >The XLL spec (3.4) reads: > >>>>Note that many of the attributes may be provided for both the parent >linking element and the child locator element. If any such attribute is >provided in the linking element but not in a locator element, the value >provided in the linking element is to be used in processing the locator >element. In other words, the attributes provided in the linking element may >serve as defaults for the (possibly many) locator elements. > >This requires the implementation to provide for LOCATORs (children) to >'inherit' attributes from EXTENDED (parent). In my own DTD I would like to >be able to use this philosophy, as in the following simple example of a >list of numbers, all of type FLOAT > ><LIST> > <VAR TITLE="x" TYPE="FLOAT">1.2</VAR> > <VAR TITLE="y" TYPE="FLOAT">2.3</VAR> ><!-- ... --> ></LIST> > >can be abbreviated to > ><LIST TYPE="FLOAT"> > <VAR TITLE="x">1.2</VAR> > <VAR TITLE="y">2.3</VAR> ><!-- ... --> ></LIST> > > >Is this seen as a sufficiently general mechanism in XML that it is worth >creating a DTD-independent engine for this? If so, is there a general >mechanism for indicating (in the document instance or DTD) that this >operation is to be carried out? At present it is only prose in the XLL >spec? It might be preferable to have a syntactic stement of this >requirement - do otehrs feel the same? Can AFs be used? > >[At present I have hardcoded the XLL prose into JUMBO but I don't feel >happy about it, especially if the spec changes in the future. In some >circumstances I imagine that entities could achieve some simplification, >but they don't allow a child attribute value to override a parent value.] xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@i... Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ To (un)subscribe, mailto:majordomo@i... the following message; (un)subscribe xml-dev To subscribe to the digests, mailto:majordomo@i... the following message; subscribe xml-dev-digest List coordinator, Henry Rzepa (mailto:rzepa@i...)
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|