XUL Template Primer - Multiple Rules
Selecting a Rule
This document expands on the
XUL Template Primer
by illustrating how multiple
can interact to create content using the extended XUL template
To illustrate how multiple
interact, we'll examine this
which builds a simple content model from an RDF/XML file.
As you can see, there are two
contained within the
This RDF/XML creates the following model.
When thrown together in Mozilla, the following appears:
Lumpy's street address is "unknown"! In this case, the first rule was matched twice: once for Alison and once for Jack, and the second rule (which has no constraints on one being landed gentry) matched once.
When more than one rule exists, the
should specify a
These attributes specify which variables correspond to "containerhood" and "membership" in the rules that follow.
Each rule must use these variables consistently.
If these are not specified, then they will be deduced from the first rule.
Selecting a Rule
Even though more than one rule might match for a
particular container/member pair, only one rule is allowed to
actually build content. When this happens, the selection process
is simple: the first rule listed in
<template> is chosen.
In our example, the second rule matches for both Alison and Jack; however, since the first rule also matches, it "masks" the second rule.
- XUL Template Primer
- XUL template basics.
- XUL Template Primer - Bindings
Illustrates how to use the
<bindings>tag in your XUL templates.
- XUL Template Primer - Nested Content
- Illustrates how a template can be used recursively to build nested content.
- XUL Template Primer - Outliner
- Illustrates how a template can be used as a view for a XUL outliner.
- XUL Template Reference
- Describes the simple XUL template syntax in detail.