Changing attributes: Overview

Several ways for elements to possess attributes:

  • By being a member of an attribute class
  • By having attributes privately

Hence, several ways to remove attributes from elements:

  • By deleting the attribute class from the schema altogether
  • By deleting the attribute from the attribute class
  • By unsubscribing the element from that attribute class
  • By removing a privately held attribute from the element that owns it

So far we’ve learned how to include modules and include or exclude elements. How about if we want to change or remove an attribute? Let’s focus first on removing attributes.

Elements get attributes by belonging to an attribute class. So, for example, because <div> is in the attribute class att.typed, it gets the type and subtype attributes (just like all members of that attribute class: persName, head, note, and a whole bunch of other elements).

And elements can also have attributes privately. These are attributes that belong to that element alone, rather than being part of a class. For example, <handShift> has its @new attribute, and <relation> has its @mutual attribute.

Hence there are a few different ways to remove an attribute. To remove it from the entire schema, you can either delete the entire attribute class from the schema or delete the attribute from the attribute class it belongs to. If you delete an entire attribute class, this of course deletes all the attributes that are members of that class. So, if you never plan to use either the full or the sort attribute on your names, you might delete the att.personal class from your schema.

If you delete the attribute from the class it belongs to, no element in the schema will have that attribute, but the others in the class will survive. So if you think the subtype attribute is evil and unnecessary, you might want to delete it from the att.typed class, thus leaving the ever-important type attribute.

To remove an attribute from a single element, you can remove the element from that attribute class (note that this is for attributes that are a part of attribute classes, not single attributes associated with only one element). This way the other elements that subscribe to that attribute class won’t be affected. So if you want to use subtype on <div>, but not on <head>, you would just want to remove it from <head> and leave <div> unchanged. However, when you unsubscribe an element from an attribute class, it loses all the attributes that it gets from that class. So in our example, if we remove <head> from the att.typed class, what will happen? (It will lose both type and subtype, which isn’t really what we want.) The solution is that you have to remove the element from the class, and then restore any individual attributes you want it to retain. We’ll show that in a second.

To remove an attribute from a single element, if that element is a private owner of that attribute, you can just change the definition of that specific element to remove the attribute.

We’ll illustrate all of these customizations in the next slide.

Introduction to Writing ODDs slide 05 of 24
© 2010 Syd Bauman, Julia Flanders, and the Women Writers Project This TEI-encoded XML file is available under the terms of the Creative Commons Attribution-ShareAlike 3.0 (Unported) license.