to the main page about the tutorial  THE XML REVOLUTION  -  TECHNOLOGIES FOR THE FUTURE WEB back up next

Boolean expressions

Boolean logic for expressing properties of elements: combined with and, or, not, impl, etc.

Example:

<or>
  <and>
    <attribute name="a"><stringtype ref="b"/></attribute>
    <ancestor><element name="p:c"><attribute name="d"/></element></ancestor>
  </and>
  <contents>
    <sequence><element name="p:e"/><element name="p:f"/></sequence>
  </contents>
</or>

means: "either the current element has an a attribute with a b value and also a c ancestor element with a d attribute, or - if only looking at e and f elements - its contents consist of one e element followed by one f element (where the elements use the namespace selected by the p prefix)."

Boolean expressions are used both as conditions in conditional constraints (if) and as requirements (in require).

As with the other syntactic categories, boolean expressions can be defined for modularity.

back COPYRIGHT © 2000-2003 ANDERS MØLLER & MICHAEL I. SCHWARTZBACH next