SGML

Attribute Preemption Examples

elmt-attr-decl-preemption/elementdecl-preemption.sgm
demonstrates that it's an error to preempt ("override") element declarations in the external subset
elmt-attr-decl-preemption/attlistdecl-preemption.sgm
trivially, attributes can be declared in the internal subset ...
elmt-attr-decl-preemption/attlistdecl-preemption-redeclaration.sgm
... as long as they aren't declared in the external subset
elmt-attr-decl-preemption/attlistdecl-preemption-redeclaration.sgm

however, when using WebSGML a duplicate attribute declaration isn't an error; the "first" one encountered in the internal subset is effective, the other is ignored; note $PRODUCT adopts WebSGML extensions by default and always accepts duplicate attribute declarations

elmt-attr-decl-preemption/test-with-testatt.dtd elmt-attr-decl-preemption/test.dtd
these are external DTD subsets included from the example above

elmt-attr-decl-preemption/elementdecl-preemption.sgm

<!DOCTYPE test system "test.dtd" [
	<!-- NOTE THIS ERRONOUSLY ATTEMPTS TO REDECLARE AN ELEMENT -->
	<!ELEMENT subsub - - (#pcdata)>
]>
<test><sub><subsub>blabla</subsub></sub></test>

elmt-attr-decl-preemption/attlistdecl-preemption.sgm

<!DOCTYPE test system "test.dtd" [
	<!ATTLIST subsub test CDATA #IMPLIED>
]>
<test><sub><subsub test="x">blabla</subsub></sub></test>

elmt-attr-decl-preemption/attlistdecl-preemption-redeclaration.sgm

<!DOCTYPE test system "test-with-testatt.dtd" [
	<!ATTLIST subsub test CDATA #IMPLIED>
]>
<test><sub><subsub test="x">blabla</subsub></sub></test>

elmt-attr-decl-preemption/attlistdecl-preemption-redeclaration.sgm

<!DOCTYPE test system "test-with-testatt.dtd" [
	<!ATTLIST subsub test CDATA #IMPLIED>
]>
<test><sub><subsub test="x">blabla</subsub></sub></test>

elmt-attr-decl-preemption/test-with-testatt.dtd

<!ELEMENT test - - (sub+)>
<!ELEMENT sub - - (subsub+)>
<!ELEMENT subsub - - ANY>
<!ATTLIST subsub test CDATA #IMPLIED>

elmt-attr-decl-preemption/test.dtd

<!ELEMENT test - - (sub+)>
<!ELEMENT sub - - (subsub+)>
<!ELEMENT subsub - - ANY>