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.
Example: Recursively generate a list of items
This template iterates over a list of children but does this recursively. First it generates a list of children, then for each child node, repeat the template to get the grandchildren nodes. The action requires an <vbox> since the nested elements are added as children of the tag with the uri attribute. If we had used the label instead, the nested items would be generated as children of the label and they would not show on screen. Some style rules have been used to show the structure of the generated content.
<vbox datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/all-animals">
<template>
<rule>
<conditions>
<content uri="?uri"/>
<member container="?uri" child="?animal"/>
<triple subject="?animal"
predicate="http://www.some-fictitious-zoo.com/rdf#name"
object="?name"/>
</conditions>
<action>
<vbox uri="?animal" style="border: 1px solid grey; margin: 1em;">
<label value="?name"/>
</vbox>
</action>
</rule>
</template>
</vbox>
