contentsconceptssyntaxlibrariessampleserrorsindex
Full text search
control structure   repeat over    
  Related Syntax   Related Concepts  

Syntax

  repeat over shelf-type? shelf-name (& shelf-type shelf-name)?
     local-declaration*
     action*
  again


Purpose

A special form of the repeat action used to process successive items on a given shelf. The actions are repeated once for each item on the shelf.

References to the shelf name are interpreted as though followed by item 1 during the first iteration, by item 2 in the second iteration, and so forth.

repeat over can process the items on several shelves in parallel. The first item on each shelf is processed before the loop moves to the second item, and so on, until all items on all shelves have been processed.

The keyword and can be used in place of "&".

In a repeat over action, it is often useful to know whether the loop is at the first or last iteration. Two predefined switches provide this information. The switch named #first is active only on the first iteration. The #last switch is active only on the last iteration. They are both active on the only iteration over a set with one member. These two switches are read-only; they can be tested in a switch test, but they cannot be explicitly activated or deactivated. When repeat over loops nest, each instance has its own #first and #last switches.

You can also ask for the index of the current iteration by accessing the predefined counter #item. It can be used in numeric expressions or in format items that format counters. When repeat over loops nest, each instance has its own indices.

repeat over can be used to process the following:

If a repeat over action iterates over a set of attributes or over the tokens of an attribute, or if an attribute or attribute token is identified by a using prefix, then all text written to the #markup-parser stream will be "buffered" in the same manner until the action completes.

Can you add an item to a shelf inside a repeat over loop? Yes, but only at a position greater that the size of the shelf when the loop began. The number of iterations in the loop is determined before the first iteration, and adding more items to the shelf from within the loop will not change the number of iterations being performed.

Can you remove items from a shelf within a repeat over loop? Yes, but only items that were added within the same loop.

    Related Syntax
   #markup-parser
   new, set new
   remove
   repeat over referents
   repeat over current elements
   repeat over data-attribute
   repeat over attributes
   repeat over data-attributes
 
Related Concepts
   Attribute aliases
   Loop indices
   Looping constructs
   XML/SGML parser: locking input
 
----

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

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

Copyright © OmniMark Technologies Corporation, 1988-1999.