WARNING: Most of this content (with the exception of the Mozilla 1.9 XPCOM reference) is very old, and can be expected to be out of date and possibly obsolete. For better XUL documentation, please visit the XUL hub at the Mozilla Developer Center.

nsIXULTemplateBuilder

IID:A583B676-5B02-4F9C-A0C9-CB850CB99818
Inherits From:nsISupports

A template builder, given an input source of data, a template, and a reference point, generates a list of results from the input, and copies part of the template for each result. Templates may generate content recursively, using the same template, but with the previous iteration's results as the reference point. As an example, for an XML datasource the initial reference point would be a specific node in the DOM tree and a template might generate a list of all child nodes. For the next iteration, those children would be used to generate output for their child nodes and so forth.

A template builder is attached to a single DOM node; this node is called the root node and is expected to contain a XUL template element as a direct child. Different template builders may be specialized in the manner in which they generate and display the resulting content from the template.

The structure of a template is as follows:

The datasources attribute on the root node is used to identify the source of data to be used. The ref attribute is used to specify the reference point for the query. Currently, the datasource will either be an nsIRDFDataSource or a DOM node. In the future, other datasource types may be used.

The element contains a single query and one or more elements. There may be more than one if multiple queries are desired, and this element is optional if only one query is needed -- in that case the and s are allowed to be children of the