Rule
A rule is used in a template. The children of the rule are used to declare the conditions in which the rule matches and the content that is generated. When the content needs to be displayed, the template builder scans through the RDF datasource searching for nodes that match the rules. When a rule is matched, the corresponding content is generated.
A rule contains two or three child elements. The conditions element is used to specify the conditions on which the resources in a datasource can match. Matching resources are used to generate content. Non-matching resources have no content generated for them. The action element specifies the content that is generated. The bindings element is optional and may specify additional variable bindings to be used.
All three children may use variables in place of attribute values. Variables are a question mark followed by a name. For a matched rule, each variable will be a reference to an RDF resource node. If the same variable appears multiple times, it must have the same value in each place.
A rule may use a shortcut syntax for matching that involves placing additional attributes on the rule element. The rule will match if the attribute matches an attribute on the RDF resource. When comparing attributes, the id, property and instanceOf attributes are ignored.
Each generated element will be given an id values automatically. The id values will correspond to an id of the resource in the datasource. You can use this id in a script to examine the resource.
Attributes:
iscontainer | isempty | parent | parsetype |
Attributes:
Inherited from XUL Element:
align
allowevents
allownegativeassertions
class
coalesceduplicatearcs
collapsed
container
containment
context
contextmenu
datasources
dir
empty
equalsize
flags
flex
height
hidden
id
insertafter
insertbefore
left
maxheight
maxwidth
menu
minheight
minwidth
mousethrough
observes
ordinal
orient
pack
persist
popup
position
preference-editable
ref
removeelement
sortDirection
sortResource
sortResource2
statustext
style
template
tooltip
tooltiptext
top
uri
wait-cursor
width
iscontainer
Type: boolean
Indicates whether rules match based on containment. If not specified, the rule may match regardless of whether a node is a container or not.
- true: The rule will only match nodes that are marked as containers. This would apply to nodes that represent folders.
- false: The rule will only match nodes that are not marked as containers.
isempty
Type: boolean
Indicates whether rules match based on emptyness. If not specified, the rule may match regardless of whether a node has children or not.
- true: The rule will only match nodes that contain no child elements.
- false: The rule will only match nodes that contain one or more child elements.
parent
Type: element tag name
If set, the rule will only match the corresponding tag. This may be used to have separate rules for leaf and container nodes with different tags.
parsetype
Type: string
If this attribute is set to 'Integer', the rule will only match RDF nodes with a parse type of Integer.
Properties and Methods:
Inherited from XUL Element:
Inherited from Element: