WARNING: Most of this content (with the exception of the Mozilla 1.9 XPCOM reference) is very old, and can be expected to be out of date and possibly obsolete. For better XUL documentation, please visit the XUL hub at the Mozilla Developer Center.

Index

Example: Iterate over the children using a predicate

In this example, we iterate over a predicate instead of the children of a container. We want to iterate over Robert's favorite animals, since he has four. We specify the 'favoriteAnimal' predicate using the 'containment' attribute. This causes the <member> tag to iterate over that predicate.

View   View Data Source

<vbox datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/humans/robert"
      containment="http://www.some-fictitious-zoo.com/rdf#favoriteAnimal">
  <template>
    <rule>
      <conditions>
          <content uri="?uri"/>
          <member container="?uri" child="?child"/>
          <triple subject="?child"
                  predicate="http://www.some-fictitious-zoo.com/rdf#name"
                  object="?name"/>
      </conditions>
      <action>
        <label uri="?child" value="?name"/>
      </action>
    </rule>
  </template>
</vbox>