Example: Generate descendants depending on the parent

In this example, we want to display a set of labels for all animals except mammals which we want to display in a menu button. For this, four rules are used, the first two for containers and the other two for the leaf nodes. In the first rule, a condition filters out all animal classes that are non mammals. Those other types will fall through to the second rule. For mammals, a menu button is used. For other types, an hbox with a label in used instead.

When recursing into the leaf animal nodes, the third rule is used for mammals and the fourth rule for other types. The third rule uses a parent attribute which causes the rule to only match when the contents would be inserted into a button tag. This will only apply to the mammals since the mammals container generated a button. The others would be inserted into an hbox tag so the fourth rule is used instead. This last rule generates a label.

View   View Data Source

<vbox align="start" datasources="animals.rdf"
    <rule iscontainer="true" animals:name="Mammals">
      <button type="menu" uri="rdf:*" label="rdf:"/>
    <rule iscontainer="true">
      <hbox uri="rdf:*">
        <label class="header" value="rdf:"/>
    <rule parent="button">
        <menuitem uri="rdf:*" label="rdf:"/>
      <label class="indent" uri="rdf:*" value="rdf:"/>
Copyright © 1999 - 2005