Index

Example: Iterate over the children, dependent on a grandchild

In this example, we attempt to retrieve the 'class' of the Llama. A conditional is used against the grandchild node which restricts results to only the Llama. However, the iteration is done over the child, not the grandchild, as indicated by uri="?child" in the action.

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="?child"/>
          <triple subject="?child"
                  predicate="http://www.some-fictitious-zoo.com/rdf#name"
                  object="?name"/>
          <member container="?child" child="?grandchild"/>
          <triple subject="?grandchild"
                  predicate="http://www.some-fictitious-zoo.com/rdf#name"
                  object="Llama"/>
      </conditions>
      <action>
        <label uri="?child" value="?name"/>
      </action>
    </rule>
  </template>
</vbox>
Copyright © 1999 - 2005 XULPlanet.com