<!ELEMENT Document (Paragraph)*> <!ELEMENT Paragraph (#PCDATA)> <!ATTLIST Paragraph Role CDATA>
Using the above DTD the author can create a document like this:
<Document> <Paragraph Role="warning"> Do not attempt this at home. </Paragraph> <Paragraph> The following is a set of instructions for creating a bungee jumping cord from elastic bands ... </Paragraph> </Document>
The author intends for the "Do not attempt this at home" paragraph to appear emphasized in some way, for example in bold or in a different color. The DTD designer would have had no way of knowing the special needs of the author of the document, so a Role Attribute was placed on the paragraph, to allow for different types of paragraphs to exist.
Including role attributes allows the author to have a great deal of flexibility. The flexibility may make the creation of processing software very difficult. Processing software will not be able to know in advance the intention of the author. However, by allowing customization of processing software through the use of scripts or stylesheet, this can be a very powerful pattern. Much of the power of XSLT (http://www.w3.org/TR/xslt) and CSS (http://www.w3.org/Style/) comes from being able to add Role Attributes.
Role attributes can be used to extend the document type without changing the structure of documents. This can help extend the life of the document type between revisions, and can be used to prototype new features of the document type.
XHTML uses several role attributes including class and meta element in XHTML.
The XMLspec DTD role attribute (http://www.w3.org/XML/1998/06/xmlspec-report-v21.htm#AEN620) shows a typical usage of this pattern.