number of current elements

operator

Return type:
Integer
Returns:
The number of currently opened elements.
Syntax
number of current elements (of element-expression)?
    


Purpose

number of current elements is used to determine the depth of the open element stack. If element-expression is specified and identifies an open element, then number of current elements returns the number of open elements in the range beginning with the outermost element and ending with the element identified by element-expression.

If there are no opened elements or if element-expression does not identify an open element, number of current elements returns 0.

The following element rule uses number of current elements to do a rudimentary indentation and pretty-printing of the markup being processed:

  element #implied
     output "   " ||* number of current elements || "<" || name of element || ">%n"
         || "%c"   
         || "   " ||* number of current elements || "</" || name of element || ">%n"
          

Related Syntax