children

operator

Return type:
Integer
Returns:
Returns the number of subelements of the element specified by element-expression or the current element.
Syntax
children (of element-expression)?
    


Purpose

The children is operator returns the number of subelements of the given element that have occurred thus far in processing.

If element-expression is not specified, children returns the number of subelements of the current element. If it is used before the current element is processed, it will return zero.

If element-expression is specified, the count of the children processed thus far of the indicated element is returned, including the currently open child. Inclusions are counted, as well as proper subelements.

For example, the following block uses children to ensure that the actions contained in the guarded block will only be executed for the first child element of the parent:

  do when children of parent = 1
     ; ...
  done

Related Syntax