number of current subdocuments

operator

Return type:
Integer
Returns:
The number of subdocuments of the current document or instance.
Syntax
number of current subdocuments


Purpose

An operator that allows the programmer to quickly determine how deeply the subdocuments being parsed are nested. number of current subdocuments returns the number of subdocuments of the current document or instance (that is not a subdocument) being parsed.

The value returned is determined as follows:

  • outside of any do sgml-parse, the value returned is zero (0).
  • a do sgml-parse for document or instance saves the current value of number of subdocuments and resets it to zero. At the end of processing the do sgml-parse, the saved value is restored.
  • a do sgml-parse for subdocument increments the current value of number of current subdocuments. At the end of processing the do sgml-parse, the value of number of current subdocuments is decremented to its value on entry to the do sgml-parse.