("rdfgeneric[%p] no <conditions> element in extended rule", this));
("xultemplate[%p] no <conditions> element in extended rule", this));
nsXULTemplateBuilder::CompileExtendedRule(nsIContent* aRule,                                          PRInt32 aPriority,                                          InnerNode* aParentNode){    // Compile an "extended" <template> rule. An extended rule must    // have a <conditions> child, and an <action> child, and may    // optionally have a <bindings> child.    nsresult rv;    nsCOMPtr<nsIContent> conditions;    gXULUtils->FindChildByTag(aRule, kNameSpaceID_XUL, nsXULAtoms::conditions,                              getter_AddRefs(conditions));    if (! conditions) {        PR_LOG(gLog, PR_LOG_ALWAYS,               ("rdfgeneric[%p] no <conditions> element in extended rule", this));        return NS_OK;    }    nsCOMPtr<nsIContent> action;    gXULUtils->FindChildByTag(aRule, kNameSpaceID_XUL, nsXULAtoms::action,                              getter_AddRefs(action));    if (! action) {        PR_LOG(gLog, PR_LOG_ALWAYS,               ("rdfgeneric[%p] no <action> element in extended rule", this));        return NS_OK;    }    // If we've got <conditions> and <action>, we can make a rule.    Rule* rule = new Rule(action, aPriority);    if (! rule)        return NS_ERROR_OUT_OF_MEMORY;    rv = CompileConditions(rule, conditions, aParentNode);    if (NS_FAILED(rv)) return rv;    // XXXwaterson TODO: add <bindings>    // grovel over <action> to find MemberVariable.    //    // XXXwaterson assume that the first "uri='?var'" attribute that    // we find in a breadth-first descent is the member variable?    // Maybe we should add an attribute on the <action> tag that lets    // the user specify the member variable.    nsVoidArray unvisited;    unvisited.AppendElement(action.get());    while (unvisited.Count()) {        nsIContent* next = NS_STATIC_CAST(nsIContent*, unvisited[0]);        unvisited.RemoveElementAt(0);        nsAutoString uri;        next->GetAttribute(kNameSpaceID_None, nsXULAtoms::uri, uri);        if (uri[0] == PRUnichar('?')) {            PRInt32 membervar = rule->LookupSymbol(uri);            if (membervar) {                rule->SetMemberVariable(membervar);                break;            }        }        // otherwise, append the children to the unvisited list: this        // results in a breadth-first search.        PRInt32 count;        next->ChildCount(count);        for (PRInt32 i = 0; i < count; ++i) {            nsCOMPtr<nsIContent> child;            next->ChildAt(i, *getter_AddRefs(child));            unvisited.AppendElement(child.get());        }    }    return NS_OK;}