[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: References in default attribute values
richard@c... wrote: > If a default for an attribute value contains an entity reference, must > the entity be declared before attribute list declaration? I cannot > see such a requirement, and I find this surprising since there *is* > such a requirement for (parameter) references in entity declarations. I'm not positive about the rules in XML, but in SGML it _is_ necessary for the general entity declaration to appear first, as near as I can tell. (SGMLS agrees) By productions [143], [147], [33], and [34], the default value in an attribute definition is parsed as replaceable character data, which means that general entity references are recognized and replaced, and the rule that entities must be declared before they are referenced applies. [ Another, erm, interesting fact is that parameter entity references are _not_ replaced in attribute value literals in ATTLIST declarations. E.g.: <!ENTITY % e1 "foo"> <!ENTITY % e2 "%e1;" -- %e1; is expanded here --> <!ATTLIST %e1; -- and here --> A1 CDATA #FIXED %e1; -- and here -- A2 CDATA #FIXED "%e1;" -- but not here! -- > I've been fooled by this more than once... ] --Joe English jenglish@c... [143] attribute definition (11.3, 421:1) = ( attribute name [144], +ps [65], declared value [145], +ps [65], default value [147] ) [147] default value (11.3.4, 425:1) = ( ( ?( rni ("#"), "FIXED", +ps [65] ), attribute value specification [33] ) | ( rni ("#"), ( "REQUIRED" | "CURRENT" | "CONREF" | "IMPLIED" ) ) ) [33] attribute value specification (7.9.3, 331:1) = ( attribute value [35] | attribute value literal [34] ) [34] attribute value literal (7.9.3, 331:4) = ( ( lit ("\""), replaceable character data [46], lit ("\"") ) | ( lita ("'"), replaceable character data [46], lita ("'") ) ) xml-dev: A list for W3C XML Developers Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ To unsubscribe, send to majordomo@i... the following message; unsubscribe xml-dev List coordinator, Henry Rzepa (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
|