Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Other Modifications > Adding a Value to an Enumerated Attribute - Pg. 69

Other Modifications Changing the Contents of the role Attribute The role attribute, found on almost all of the elements in DocBook, is a text attribute that can be used to subclass an element. In some applications, it may be useful to modify the definition of role so that authors must choose one of a specific set of possible values. In Example 5-14, the role attribute on the procedure element is constrained to the value required or optional . Example 5-14. Changing role on procedure namespace db = "http://docbook.org/ns/docbook" include "docbook.rnc" { db.procedure.role.attribute = attribute role { "required" | "optional" } } Adding a Value to an Enumerated Attribute Example 5-15 adds the value " large " to the db.spacing.enumeration pattern. Any at- tribute that is defined using db.spacing.enumeration will now have large as a legal value. Note that while it is easy to add a value to an enumeration, to remove a value from an enumeration you need to redefine the entire enumeration, minus the values you don't need. Example 5-15. Adding a value to an enumeration namespace db = "http://docbook.org/ns/docbook" default namespace = "http://docbook.org/ns/docbook" include "docbook.rnc" # add a value to an enumeration db.spacing.enumeration |= "large" Other Modifications | 69