Parameterizing Attributes

Attribute declarations also benefit from parameterization. For example, the type attribute of the Transaction element can be declared as follows.

<!ENTITY % TypeAtt "type">
<!ENTITY % type.extra "">
<!ATTLIST %TransactionElement; %TypeAtt;
  (withdrawal | deposit | transfer %type.extra;)
  #REQUIRED>

Now you can change the name of the attribute by redefining the TypeAtt entity or add an additional value by redefining the type.extra entity. For example, the redefinition below adds a balanceInquiry type.

<!ENTITY % type.extra " |  balanceInquiry ">

Get Effective XML: 50 Specific Ways to Improve Your XML now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.