When iterating over the children of an RDF container, there is a simpler rule syntax which may used. It may also be used when iterating over only one predicate. Simple RDF graph navigation such as this is common, so the simpler syntax is usually used in this situation since it avoids extra tags, although the simple syntax is not more or less efficient, at least when a single rule is involved. A simple rule is equivalent to a rule with only the content tag and a member tag, as well as optionally a set of triples from the child node. At it's simplest, the simple rule syntax is equivalent to the following conditions:

  <content uri="?start"/>
  <member container="?start" child="?photo"/>

The template builder uses the simple rule syntax whenever a template rule does not have a <conditions> element. If a <conditions> element is present, the full syntax is used instead. In the simple syntax, the builder will use the default conditions shown above, although the variable names are randomly generated.

Since the photos list iterates over the children of a container, we can use the simple syntax. Here is what it might look like:

  <vbox class="box-padded" uri="rdf:*">
    <image src="rdf:*"/>
    <label value="rdf:http://purl.org/dc/elements/1.1/title"/>

There is no <conditions> or <action> element used. Instead, the builder uses a default set of conditions, and the action is placed directly inside the <rule> element. You can see that this code is much simpler than the full syntax. To understand how this works, let's examine how the builder processes a simple rule. First, it evaluates the default conditions as above, except that no variables are used, or at least, not ones that are used externally. In reality, the builder could be considered to convert a simple rule into an extended rule, so that it can be processed in the same way. After the default conditions are evaluated, the data network will look something like this:

(?1 = http://www.xulplanet.com/rdf/myphotos,
 ?2 = http://www.xulplanet.com/ndeakin/images/t/palace.jpg)
(?1 = http://www.xulplanet.com/rdf/myphotos,
 ?2 = http://www.xulplanet.com/ndeakin/images/t/canal.jpg)
(?1 = http://www.xulplanet.com/rdf/myphotos,
 ?2 = http://www.xulplanet.com/ndeakin/images/t/obselisk.jpg)

The numbers are used here for the variable names, but they are really just randomly generated so you can't refer to them in any way. The member data, or results are held in the variable represented by '?2'. Three matches have been found so the content will be duplicated three times.

There are several attributes in the content that have values prefixed with 'rdf:'. Since you can't declare variables in the simple syntax, a different way is used to grab RDF data. The 'rdf:' prefix means look up a predicate pointing out of the node for that result (the child or member node). For example, the label's value attribute has a value of "rdf:http://purl.org/dc/elements/1.1/title". This means look up the value of the predicate "http://purl.org/dc/elements/1.1/title" pointing out of the current result. Of course, it should be obvious that this causes the value attribute to be set to the photo's title.

You can get other predicates in the same way, just by using the predicate uri and prefixing it with 'rdf:'. You can also combine two in one attribute by separating them with a space or a caret (^) just as you can with the full syntax. For example:

<label value="rdf:http://purl.org/dc/elements/1.1/title http://www.xulplanet.com/rdf/country"/>

The 'rdf:' form is really equivalent to the <binding> tag in the full syntax. The subject of the binding is the result member resource, the predicate is the string that comes after 'rdf:' and the object isn't necessary as the value is replaced directly in the attribute. As with bindings, the value is not required to match, so the data doesn't have to exist in the RDF graph. If one photo doesn't have a title, it will be replaced with an empty string.

The special value 'rdf:*' means the uri of the result resource, rather than referring to a predicate. It would be equivalent to ?photo variable in this example if the full syntax was used. You can see in the example that the value 'rdf:*' is used in two places, the uri attribute on the hbox and as the src attribute for the image.

Here is the photos example using the simple syntax. The filtering isn't shown in this example. It is still possible to do filtering using simple rules and we'll look at this next.