NS_LITERAL_STRING("index"),
indexStr,
nsXFormsSetIndexElement::HandleAction(nsIDOMEvent            *aEvent,                                      nsIXFormsActionElement *aParentAction){  if (!mElement)    return NS_OK;    // Get @repeat and @index  nsAutoString id, index;  mElement->GetAttribute(NS_LITERAL_STRING("repeat"), id);  mElement->GetAttribute(NS_LITERAL_STRING("index"), index);  if (id.IsEmpty() || index.IsEmpty()) {    /// @todo Should we dispatch an exception, or just define that this does    /// not happen as it is a non-validating form as both are required    /// attributes, and index should be an integer? (XXX)    return NS_ERROR_ABORT;  }  // Find index (XPath) value  nsresult rv;  nsCOMPtr<nsIModelElementPrivate> model;  nsCOMPtr<nsIDOMXPathResult> result;  // EvaluateNodeBinding uses @bind if @index is not present, but we have  // checked that @index is present above  rv = nsXFormsUtils::EvaluateNodeBinding(mElement,                                          0,                                          NS_LITERAL_STRING("index"),                                          EmptyString(),                                          nsIDOMXPathResult::NUMBER_TYPE,                                          getter_AddRefs(model),                                          getter_AddRefs(result));  NS_ENSURE_SUCCESS(rv, rv);  if (!result) {    // beaufour: This makes sense, but is not according to the spec. I guess...    nsXFormsUtils::DispatchEvent(mElement, eEvent_BindingException);    return NS_ERROR_ABORT;  }  double indexDoub;  rv = result->GetNumberValue(&indexDoub);  NS_ENSURE_SUCCESS(rv, rv);  PRUint32 indexInt = indexDoub < 1 ? 0 : (PRUint32) floor(indexDoub);  // Find the \<repeat\> with @id == |id|  nsCOMPtr<nsIDOMDocument> domDoc;  rv = mElement->GetOwnerDocument(getter_AddRefs(domDoc));  NS_ENSURE_SUCCESS(rv, rv);#ifdef DEBUG_XF_SETINDEX  printf("<setindex>: Setting index '%s' to '%d'\n",         NS_ConvertUCS2toUTF8(id).get(),         indexInt);#endif    nsCOMPtr<nsIDOMElement> repeatElem;  rv = domDoc->GetElementById(id, getter_AddRefs(repeatElem));  nsCOMPtr<nsIXFormsRepeatElement> repeat = do_QueryInterface(repeatElem);  if (!repeat) {    // beaufour: This makes sense, but is not according to the spec. I guess...    nsXFormsUtils::DispatchEvent(mElement, eEvent_BindingException);    return NS_ERROR_ABORT;  }  // Set the index = |indexInt|  return repeat->SetIndex(&indexInt, PR_FALSE);}