Example: Generate a set of menulists

This template iterates over a list of the animal classes. For each class, it generates a menulist. This template uses two rules. In the first rule, we use the simple syntax to match all containers and will generate a vbox with a label in it. The label is bound to the name predicate.

The second rule matches all non-containers which will be the individual animals. We use the full syntax despite that the simple rule syntax could be used since we are only iterating over a container. The condition generates the list of children of the classes. Since the template builder does recursion automatically, the second rule will apply to the inner items. The content will be inserted as children of the parent's hbox (which is defined in the first rule). The menulist and menupopup is only generated once for each list of children since the uri attribute is used on the menuitem tag.

View   View Data Source

<vbox datasources="animals.rdf" ref="">
    <rule iscontainer="true">
      <hbox align="left" uri="rdf:*">
        <label value="rdf:"/>
          <content uri="?uri"/>
          <member container="?uri" child="?animal"/>
          <triple subject="?animal"
            <menuitem uri="?animal" label="?name"/>
Copyright © 1999 - 2005