Changing attributes: Specifying values

To constrain the values for an attribute:

  <elementSpec ident="title" mode="change" module="core">
    <attList>
      <attDef ident="type" mode="replace">
        <datatype>
          <dataRef key="teidata.enumerated"/>
        </datatype>
        <valList type="closed">
          <valItem ident="LP"/>
          <valItem ident="single"/>
          <valItem ident="eightTrack"/>
          <valItem ident="cassette"/>
          <valItem ident="CD"/>
          <valItem ident="VCRtape"/>
          <valItem ident="DVD"/>
          <valItem ident="blueRay"/>
        </valList>
      </attDef>
    </attList>
  </elementSpec>

First, what are these new elements doing? Let’s take a look at the new elements here and talk about what them.

<elementSpec> is stating that the TEI element being referred to is <title> (which is in the core module). It is further stating that this element is being changed (rather than added, deleted, or replaced).

We then state that we are referring to the different attibutes on <title>, using the <attList> element. The <attDef> element is referring to one specific attribute (@type), and stating that it is replacing it’s TEI definition with a different definition.

A datatype is a way of constraining what kinds of data are valid in this space. For instance, requiring that a number consist of integers only, or that a date conform to a specific format. In this case, we’re saying that the contents of the type attribute must be from a controlled list that we specify; the datatype data.enumerated is one that the TEI has defined for us, and this is the mechanism for referencing it. We’ll deal with datatypes in more detail in the next slide.

The <valList> contains the possible values; @type indicates whether the <valList> is closed (no other values permitted), semi-closed (these values will show up in a menu but others are permitted), or open (the values given are suggestions only).

If the attribute already exists use mode="change" on <attDef>; if this is a new attribute, use mode="add".

Introduction to Writing ODDs slide 08 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.