Index

Example: Iterate over elements based on type

This template iterates over the animals, but filters containers using their type instead of the iscontainer attribute. The first triple uses the rdf type predicate to get all of nodes that are animal classes. The second rule will match all animals.

View   View Data Source

<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.w3.org/1999/02/22-rdf-syntax-ns#type"
                  object="http://www.some-fictitious-zoo.com/rdf#Class"/>
          <triple subject="?animal"
                  predicate="http://www.some-fictitious-zoo.com/rdf#name"
                  object="?name"/>
      </conditions>
      <action>
        <hbox uri="?animal">
          <label class="header" value="?name"/>
        </hbox>
      </action>
    </rule>
    <rule>
      <button uri="rdf:*" label="rdf:http://www.some-fictitious-zoo.com/rdf#name"/>
    </rule>
  </template>
</vbox>
Copyright © 1999 - 2005 XULPlanet.com