It is frequently the case that a particular construct will be a child of more than one parent construct. For instance, consider our example grammar—it may be the case that a choice of people properties is needed in multiple expressions within the same grammar.

The id="..." attribute may be attached to any construct in order to label the construct with a unique ID. The presence or absence of an ID does not affect the nature of the labeled construct.

Once labeled, a construct can be referred to within any nonterminal construct (choice or sequence) using the notation <rule name="..."/>. To rework our initial example so that it compares two different people properties, we might do the following:

<?xcl-stylesheet resource="atg/ui/expreditor/xcl/grammar.xsl"?>
  <sequence id="example-sequence">
    <token><description>People whose</description></token>
    <rule name="people-property-choice"/>
      <token value="eq"><description>is</description></token>
      <token value="neq"><description>is not</description></token>
    <rule name="people-property-choice"/>
  <choice id="people-property-choice">
    <token value="name"/>
    <token value="email"/>
    <token value="gender"/>

A labeled construct need not be defined in a “standalone” manner as in the above example; it can be directly included in one parent construct as a regular child, but also referenced by other parent constructs by the <rule name=".../> notation.

Circular reference chains between constructs are legal, and are in fact an important tool for grammars, since the resulting recursion permits the user to form arbitrarily complex expressions. However, there are two cases to avoid, since they would cause the user interface to enter infinite loops of one kind or another:

Important: Many constructs are labeled so that the application code itself can identify them. In general, construct IDs should be assumed to be significant to the application and should not be changed.