XUL:Templates Plan: Difference between revisions

no edit summary
No edit summary
Line 288: Line 288:
for each <rule> and the <conditions> tag inside a <rule> is considered to be
for each <rule> and the <conditions> tag inside a <rule> is considered to be
the query.
the query.
==Simplified Syntax==
There is also a simplified syntax that may be used when there is no need
for multiple rules with conditions - that is all results should be displayed
unconditionally. The <query> and <rule> tags are not used and instead a query
attribute is used directly on the template. The action goes directly inside
the <template> with no additional tags.
  <vbox datasources="{datasource}" ref="{reference point}">
    <template query="{query}">
      {action}
    </template>
  </vbox>
This won't be available for all Query Processors. The intent is to allow a
simpler syntax for simpler cases.


==Backwards Compatible Forms==
==Backwards Compatible Forms==
Line 347: Line 330:
* template with a <query> and a <rule>
* template with a <query> and a <rule>
:    -> Full syntax; the rule should have a <conditions> tag and an <action> tag and may optionally have a <bindings> tag.
:    -> Full syntax; the rule should have a <conditions> tag and an <action> tag and may optionally have a <bindings> tag.
* template with no <query>, no <rule> and a <query> attribute
:    -> Simplified syntax


* template with no <query> and a <rule> with no <action>
* template with no <query> and a <rule> with no <action>
Line 362: Line 343:
  <vbox datasources="{datasource}"
  <vbox datasources="{datasource}"
       ref="{reference point}"
       ref="{reference point}"
       flags="dont-test-empty dont-build-content"
       flags="dont-test-empty dont-build-content dont-recurse"
       template="{template node}"
       template="{template node}"
       containment="{containment predicates}"
       containment="{containment predicates}"
Line 372: Line 353:
             container="?ref"
             container="?ref"
             member="?member"
             member="?member"
             query="{query string}"
             query="{query string}"/>
            recurse="true"/>
     <queryset>
     <queryset>
       <query>
       <query>
Line 419: Line 399:
==Recursion==
==Recursion==


Recursion is controled in one of two ways. The 'recurse' attribute enables or disables it for all generated results. If the attribute is omitted, the results are queried for a default value. This allows RDF to still be recursive while other types are not. There should also be some determination based on the element tag used.
Recursion is controled in one of two ways. The 'dont-recurse' flag disables it for all generated results. If the flag is omitted, the results are queried for a default value. This allows RDF to still be recursive while other types are not. There should also be some determination based on the element tag used.


The second method is to add a 'template' attribute on an element inside the action, pointing to another <template> via its id. The causes that template to be parsed and used for child generation.
The second method is to add a 'template' attribute on an element inside the action, pointing to another <template> via its id. The causes that template to be parsed and used for child generation.
287

edits