swirl
Guide to OmniMark 7   OmniMark home
docs home 
IndexConceptsTasksSyntaxLibrariesLegacy LibrariesErrors
 
  Related Syntax   Related Concepts  
operator  

attribute

 

 

Return type: String
Returns:       

The value of the specified attribute.



Syntax
  attribute attribute-name
      element-qualifier*  indexer


Purpose

You can access the value of an XML or SGML attribute using the attribute operator.

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.

[...] 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 qualifier 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

    Related Syntax
   attributes
   data-attribute
   attribute is specified
   attribute is defaulted
   attribute is implied
   attribute is
 
Related Concepts
   Attributes: list-valued
   Attributes: type tests
   Parsed data: formatting
 
 

Top [ INDEX ] [ CONCEPTS ] [ TASKS ] [ SYNTAX ] [ LIBRARIES ] [ LEGACYLIBRARIES ] [ ERRORS ]

OmniMark 7.1.2 Documentation Generated: June 28, 2005 at 5:44:58 pm
If you have any comments about this section of the documentation, send email to [email protected]

Copyright © Stilo Corporation, 1988-2005.