rv = BuildContentFromTemplate(tmpl, aElement, aElement, PR_FALSE, resource, PR_FALSE);
rv = BuildContentFromTemplate(tmpl, aElement, aElement, PR_FALSE, resource, PR_FALSE, aFirstGeneratedChild);
RDFGenericBuilderImpl::CreateTemplateContents(nsIContent* aElement, const nsString& aTemplateID){    // Create the contents of an element using the templates    nsresult rv;    // See if the element's templates contents have been generated:    // this prevents a re-entrant call from triggering another    // generation.    nsCOMPtr<nsIXULContent> xulcontent = do_QueryInterface(aElement);    if (! xulcontent)        return NS_OK; // HTML content is _always_ generated up-front    PRBool contentsGenerated;    rv = xulcontent->GetLazyState(nsIXULContent::eTemplateContentsBuilt, contentsGenerated);    if (NS_FAILED(rv)) return rv;    if (contentsGenerated)        return NS_OK;    // Now mark the element's contents as being generated so that    // any re-entrant calls don't trigger an infinite recursion.    rv = xulcontent->SetLazyState(nsIXULContent::eTemplateContentsBuilt);    NS_ASSERTION(NS_SUCCEEDED(rv), "unable to set template-contents-generated attribute");    if (NS_FAILED(rv)) return rv;    // Find the template node that corresponds to the "real" node for    // which we're trying to generate contents.    nsCOMPtr<nsIDOMXULDocument> xulDoc;    xulDoc = do_QueryInterface(mDocument);    if (! xulDoc)        return NS_ERROR_UNEXPECTED;    nsCOMPtr<nsIDOMElement> tmplNode;    rv = xulDoc->GetElementById(aTemplateID, getter_AddRefs(tmplNode));    if (NS_FAILED(rv)) return rv;    nsCOMPtr<nsIContent> tmpl = do_QueryInterface(tmplNode);    if (! tmpl)        return NS_ERROR_UNEXPECTED;    // Crawl up the content model until we find the "resource" element    // that spawned this template.    nsCOMPtr<nsIRDFResource> resource;    nsCOMPtr<nsIContent> element = aElement;    while (element) {        rv = gXULUtils->GetElementRefResource(element, getter_AddRefs(resource));        if (NS_SUCCEEDED(rv)) break;        nsCOMPtr<nsIContent> parent;        rv = element->GetParent(*getter_AddRefs(parent));        if (NS_FAILED(rv)) return rv;        element = parent;    }    rv = BuildContentFromTemplate(tmpl, aElement, aElement, PR_FALSE, resource, PR_FALSE);    if (NS_FAILED(rv)) return rv;    return NS_OK;}