There's been some discussion over the XUL template building process in various newsgroup threads. I've added some additional information about builders in the template section of the tutorial. A brief overview here:

When you have an element with a 'datasources' attribute, it acquires both a database and a builder object, responsible for holding the RDF datasources and constructing the content with a template respectively. The <template> tag is just a placeholder for the content to be generated. It has style 'display: none'. If you change this style, the template will appear in the document as well.

One trick many people don't know about is to move the template outside the element like this:

<template id="btem">
  <button uri="rdf:*"
<vbox datasources="rdf:bookmarks"
      ref="NC:BookmarksRoot" template="btem"/>

There are two types of builders, the content builder and the tree builder. The latter may only be used with trees, the former may be used with any kind of content, including trees. The default is the content builder. You can select the tree builder using flags="dont-build-content".

The content builder generates the content by cloning the DOM nodes in the template and inserting them into the document at the necessary position. The tree builder does not do this and gets the labels of the tree cells directly from the RDF datasource when necessary. For this reason, the tree builder is more efficient for trees with hundreds or thousands of rows. However, you can't use functions that deal with DOM elements such as those in tree.contentView since no content is generated.