Re: Attribute Question

Philippe Le Hˇgaret (Philippe.Le_Hegaret@sophia.inria.fr)
Wed, 26 Aug 1998 22:41:44 +0200


Frank Blau wrote:
>
> If I have 3 attributes ("Format", "Usage", and "Loop") that I want every
> element in my DTD to have, is there a way to globally declare them? Do
> subelements inherit the attributes of the parent element?

No, there is no way to do this with XML.
One solution is to use entities :

<!ENTITY % globalAttributes
"id ID #IMPLIED">

<!ELEMENT A #PCDATA>
<!ATTLIST A
name CDATA #REQUIRED
%globalAttributes;
>
<!ELEMENT LIST (ITEM)+>
<!ATTLIST LIST
type (ol|ul) #FIXED "ul"
%globalAttributes;
>

Regards,

Philippe.