number of attributes

operator

Return type:
Integer
Returns:
The number of attributes for an element.
Syntax
number of specified? attributes (of element-expression)?
    


Purpose

The number of attributes operator returns the number of attributes declared for an element; element-expression can be used to obtain the number of attributes declared for the element referred to by element-expression.

If specified is specified, the operator is restricted to counting only those attributes that were specified in the instance; any implied attributes are left out of the count.

The following example uses number of attributes to determine the number of attributes declared for an element and that element's parent:

  element #implied
     output "Element " || name of element || " has " 
         || "d" % number of attributes || " attribute(s).%n"
  
     output "Element " || name of element || "'s parent has " 
         || "d" % number of attributes of parent || " attribute(s).%n" 
  
     output "%c"
          

Related Syntax
Related Concepts