attributes/attr-name0
<!DOCTYPE test [
<!ELEMENT test - - (#PCDATA)>
<!ATTLIST test n NAME #REQUIRED>
]>
<test n=aname></test>
attributes/attr-name0
Example for attributes with declared value NAME
attributes/attr-names0
Example for attributes with declared value NAMES
attributes/attr-entity0
attributes/attr-entities0
Example for attributes with declared value ENTITIES
attributes/attr-id0
attributes/attr-ids0
Examples for attributes with declared value ID
and IDREF
/IDREFS
attributes/attr-number0
Example for attributes with declared value NUMBER
attributes/attr-numbers0
Example for attributes with declared value NUMBERS
attributes/attr-nutoken0
Example for attributes with declared value NUTOKEN
attributes/attlist10
attributes/attlist11
attributes/attlist12
attributes/attlist13
Examples for declaring and using #FIXED
attributes; either the value a1val
must be
specified for the a1
attribute, or the attribute must be omitted (in which case it
gets defaulted to a1val
), but specifying any other value than a1val
for
the a1
attribute is invalid
attributes/attlist3
attributes/attlist4
attributes/attlist5
attributes/attlist7
Basic example for enumerated values (using #REQUIRED
semantics);
attribute names (and the =
value indicator character) can be omitted
for specifying attributes declared with enumerated values, but only if
the enumerated value is unique among all enumerated values for all attributes of the containing DTD;
Note that prior to the WebSGML revision of SGML (ISO 8879 Annex K) SGML required this restriction, ie. all enumerated values of all attribute declarations in a DTD (not just those applying to a given element) must be distinct
attributes/attlist15
attributes/attlist16
attributes/attlist16d
Examples for declaring and using enumerated values for attributes; when
declaring a default value (attlist16), that default value will be implied
when not specified in content; but if it is specified in content, the
attribute will have the specified rather than the default value (provided the
specified value is among the permitted enumerated values); moreover,
when declaring a default or #FIXED
value, the declared default value
must be among the permitted enumerated values;
as attlist16 and attlist16d show, any attribute value
(CDATA
, enumerated values, NAME
or NMTOKEN
declared value) can, but
doen't need to be quoted (in single or double quotes) in declarations
or in content; moreover, enumerated values are subject to the
SYNTAX NAMECASE GENERAL
settings in the SGML declaration
attributes/attlist17
attributes/attlist18
Example for declaring the empty string as default value for a CDATA
attribute
attributes/notation-attr0
Example for attributes with declared value NOTATION
sgmlproc <your-file.sgm>
where <your-file.sgm> is replaced by the actual file
used for storing.
<!DOCTYPE test [
<!ELEMENT test - - (#PCDATA)>
<!ATTLIST test n NAME #REQUIRED>
]>
<test n=aname></test>
<!DOCTYPE test [
<!ELEMENT test - - (#PCDATA)>
<!ATTLIST test nn NAMES #REQUIRED>
]>
<test nn="aname another"></test>
<!DOCTYPE test [
<!ENTITY ent "bla">
<!ELEMENT test - - (#PCDATA)>
<!ATTLIST test testatt ENTITY #REQUIRED>
]>
<test testatt=ent></test>
<!DOCTYPE test [
<!ENTITY ent "bla">
<!ENTITY another "fasel">
<!ELEMENT test - - (#PCDATA)>
<!ATTLIST test testatt ENTITIES #REQUIRED>
]>
<test testatt="ent another"></test>
<!DOCTYPE test [
<!ELEMENT test - - (sub+)>
<!ELEMENT sub - - (#PCDATA)>
<!ATTLIST test i ID #IMPLIED>
<!ATTLIST sub i ID #IMPLIED ir IDREF #IMPLIED>
]>
<test i=i1><sub ir=i1></sub><sub i=i2></sub><sub ir=i2></sub></test>
<!DOCTYPE test [
<!ELEMENT test - - (sub+)>
<!ELEMENT sub - - (#PCDATA)>
<!ATTLIST test i ID #IMPLIED>
<!ATTLIST sub i ID #IMPLIED ir IDREFS #IMPLIED>
]>
<test i=i1><sub ir=i1></sub><sub i=i2></sub><sub ir="i1 i2"></sub></test>
<!DOCTYPE test [
<!ELEMENT test - - (#PCDATA)>
<!ATTLIST test n NUMBER #REQUIRED>
]>
<test n=4321></test>
<!DOCTYPE test [
<!ELEMENT test - - (#PCDATA)>
<!ATTLIST test n NUMBERS #REQUIRED>
]>
<test n="4321 789"></test>
<!DOCTYPE test [
<!ELEMENT test - - (#PCDATA)>
<!ATTLIST test n NUTOKEN #REQUIRED>
]>
<test n=43px></test>
<!DOCTYPE test [
<!ELEMENT test - - (#PCDATA)>
<!ATTLIST test a1 CDATA #IMPLIED a2 CDATA #IMPLIED>
]>
<test a1="a1 value" a2="a2 value"></test>
<!DOCTYPE test [
<!ELEMENT test - - (#PCDATA)>
<!ATTLIST test a1 CDATA #FIXED a1val>
]>
<test></test>
<!DOCTYPE test [
<!ELEMENT test - - (#PCDATA)>
<!ATTLIST test a1 CDATA #FIXED "a1 val">
]>
<test></test>
<!DOCTYPE test [
<!ELEMENT test - - (#PCDATA)>
<!ATTLIST test a1 CDATA "a1 val">
]>
<test></test>
<!DOCTYPE test [
<!ELEMENT test (#PCDATA)>
<!ATTLIST test a (x|y|z) #REQUIRED>
]>
<test a="x"></test>
<!DOCTYPE test [
<!ELEMENT test (#PCDATA)>
<!ATTLIST test a (x|y|z) #REQUIRED>
]>
<test a="y"></test>
<!DOCTYPE test [
<!ELEMENT test (#PCDATA)>
<!ATTLIST test a (x|y|z) #REQUIRED>
]>
<test a="z"></test>
<!DOCTYPE test [
<!ELEMENT test (#PCDATA)>
<!ATTLIST test a (x|y|z) #REQUIRED>
]>
<test x></test>
<!DOCTYPE test [
<!ELEMENT test - - (#PCDATA)>
<!ATTLIST test a1 (abc|def|ghi) def>
]>
<test></test>
<!DOCTYPE test [
<!ELEMENT test - - (#PCDATA)>
<!ATTLIST test a1 (abc|def|ghi) def>
]>
<test a1=abc></test>
<!DOCTYPE test [
<!ELEMENT test - - (#PCDATA)>
<!ATTLIST test a1 (abc|def|ghi) #fixed def>
]>
<test a1=Def></test>
<!DOCTYPE test [
<!ELEMENT test - - (test2)>
<!ELEMENT test2 - - (#PCDATA)>
<!ATTLIST (test|test2) a1 (abc|def|ghi) def>
]>
<test><test2 a1=abc></test2></test>
<!DOCTYPE test [
<!ELEMENT test - - (#PCDATA)>
<!ATTLIST test a1 CDATA "">
]>
<test></test>
<!doctype test [
<!notation somenotation system "whatever">
<!element test - - (#pcdata)>
<!attlist test notationattr notation (somenotation) #implied>
]>
<test notationattr=somenotation>blabla</test>