contentsconceptssyntaxlibrariessampleserrorsindex
Full text search
operator   attribute    
Sample Code   Related Syntax   Related Concepts  

Syntax

  attribute attribute-name
      element-qualifier* ((item | @ ) numeric-expression)


Purpose

Unlike programmer-defined data types, attribute references always have the attribute herald. This is because attributes are defined in the SGML document and not in the OmniMark program.

Attribute references are always treated as string expressions, even if the attribute was declared in the SGML document to be of type NUMBER. However, string expressions which contain a valid representation of a decimal number can be used anywhere where a numeric expression is permitted, so this interpretation places no restriction on the use of attributes.

Attributes can always be further identified by following the attribute name with an element qualifier.

Within the external-data-entity rule, unqualified attributes are data attributes; in other contexts, they are attributes of the current element.

item (or "@") can be used if the attribute was declared as a list-valued attribute. However, unlike shelves, for which the lastmost value is selected unless indicated otherwise, attributes do not have a "default" selected value: if no index is specified, the whole attribute value is either tested or is output as a single unit.

Attribute references provide the attribute value unmodified, except for:

In particular, translate rule processing is not performed on the value of an attribute when it is referenced using the attribute herald. This contrasts with references to an attribute value using the "%v" modifier.

Attempting to access an attribute will cause an error:

When using element-qualifiers the programmer should be aware that:

In the header and body of an external-data-entity rule, all unqualified references to attributes actually refer to data attributes of the external entity being processed. In all other rules, they refer to element attributes (attributes of element start tags).

Unqualified references to attributes inside functions always refer to element attributes. In order to refer to the data attributes of an external entity being processed, the qualiifer of entity must be specified.

Element qualifiers can themselves be qualified.

This sample shows how the of ancestor qualifier can list several element names. Note that of preparent and of open element can also be used to perform this function.

  attribute indent of ancestor (numlist | bullist | deflist)

Specifically, this line of code refers to the indent attribute of a containing numlist, bullist, or deflist, whichever comes first, searching outwards from the current element. Note that an error would result if the first element encountered did not have a value specified for the indent attribute.

The following example illustrates how element qualifiers can be used with attribute references. By using the element qualifier of ancestor, this line of code refers to the "date" attribute of an enclosing element whose name is "change".

  attribute date of ancestor change

Sample Code  
   Shelves: using the attributes shelf for normalization
 
Related Syntax
   attributes
   data-attribute
   using attribute
   attribute is specified
   attribute is defaulted
   attribute is implied
   attribute is
 
Related Concepts
   Attributes: list-valued
   Attributes: type tests
 
----  

Top [CONTENTS] [CONCEPTS] [SYNTAX] [LIBRARIES] [SAMPLES] [ERRORS] [INDEX]

Generated: April 21, 1999 at 2:01:02 pm
If you have any comments about this section of the documentation, send email to [email protected]

Copyright © OmniMark Technologies Corporation, 1988-1999.