Attributes: list-valued

A list-valued attribute's declaration is one of:

  • entities
  • idrefs
  • names
  • nmtokens
  • numbers
  • nutokens

When the attribute is a list-valued attribute, a particular item in the list can be accessed by item number with a [...] phrase. For example:

  attribute col-w[3]

The selector must not be greater than the number of items in the attribute value. The number of items in a list-valued attribute can be determined by using the number of operator.

Determining the system, public identifier, or notation of an entity name used in an ENTITIES attribute requires the use of the [...]) phrase.

List-valued attributes differ from shelves in the following ways:

  • A list-valued attribute does not have a default item. By referencing a list-valued attribute as a string expression, without a [...]) phrase, the entire value will be selected as if it were a single string without each token being separated by a space. (A different character can be used to separate the values by specifying it in the delimiter declaration.)
  • Items in list-valued attributes cannot be assigned keys. The has key operator is not permitted on a list-valued attribute.

The following is an example of how a repeat over can be used to iterate over the values in a list-valued attribute:

  element e
     local integer attribute-value-length variable
     ...
     repeat over attribute-value-length & attribute multi
        set attribute-value-length to length of attribute multi
     again

Related Topics