1.4. Xscript sections and events

    The Xscript of an element, attribute, or text node can contain several parts. Parts of an Xscript is divided to different sections containig code whih is executed in different situations.
    So far, we have described the element quantifier and also the method used to verify the text value of an attribute or text node. This pair is called the validation section (specifying a validation section is allowed only in the Xscript of attributes and text nodes). The other sections are quoted using a keyword that indicates the situation or event when the section code will be invoked:

onTrue         invoked if validation method in the validation section of an attribute found data value correct.
onFalse        invoked if validation method in the validation section of an attribute or text node found an error.
init           invoked when the processing of the item started (before other actions).
onElementStart invoked when all attributes were processed before processing of child nodes of processed element.
default        invoked if an attribute or text node is missing. The invoked code must return the required value.
onAbsence      invoked if the item is missing (never invoked if "default" is specified).
create         invoked only in the construction mode (will be described later).
finally        invoked at the end of the processing of the element.
match          called before processing the item. The called code must return a parsed result or a boolean value.
               The item is accepted for further processing if no error is reported or if result value is true.
option         parameters used when an item is processed.
Example:
<Book xd:script="init outln('Book process started'); finally outln('end'); option ignoreComments, trimAttr, trimText"
      ISBN="int(10000000, 999999999); onTrue outln('ISBN is OK'); onFalse outln('ISBN error');"
      published="optional gYear(); onAbsence outln('date missing');" > 
  <Author xd:script="occurs *"> string(); onTrue outln('Author: ' + getText()); </Author>
  <Title> string(); onTrue outln('Title: ' + getText()); </Title>
</Book>