if(parent!=nsnull) {
if (parent) {
HTMLContentSink::ProcessLINKTag(const nsIParserNode& aNode){  nsresult  result = NS_OK;  nsIHTMLContent* parent = nsnull;    if(mCurrentContext!=nsnull) {    parent=mCurrentContext->mStack[mCurrentContext->mStackPos-1].mContent;  }    if(parent!=nsnull) {    // Create content object    nsCOMPtr<nsIHTMLContent> element;    nsCOMPtr<nsINodeInfo> nodeInfo;    mNodeInfoManager->GetNodeInfo(nsHTMLAtoms::link, nsnull, kNameSpaceID_HTML,                                  *getter_AddRefs(nodeInfo));    result = NS_CreateHTMLElement(getter_AddRefs(element), nodeInfo, PR_FALSE);    if (NS_SUCCEEDED(result)) {      PRInt32 id;      mDocument->GetAndIncrementContentID(&id);            element->SetContentID(id);      nsCOMPtr<nsIStyleSheetLinkingElement> ssle(do_QueryInterface(element));      if (ssle) {        // XXX need prefs. check here.        if(!mInsideNoXXXTag) {          ssle->InitStyleLinkElement(mParser, PR_FALSE);        }        else {          ssle->InitStyleLinkElement(mParser, PR_TRUE);        }        ssle->SetEnableUpdates(PR_FALSE);      }      // Add in the attributes and add the style content object to the      // head container.          element->SetDocument(mDocument, PR_FALSE, PR_TRUE);      result = AddAttributes(aNode, element);      if (NS_FAILED(result)) {        return result;      }      parent->AppendChildTo(element, PR_FALSE, PR_FALSE);      if (ssle) {        ssle->SetEnableUpdates(PR_TRUE);        result = ssle->UpdateStyleSheet(PR_TRUE, mDocument, mStyleSheetCount);        if (NS_SUCCEEDED(result) || (result == NS_ERROR_HTMLPARSER_BLOCK))          mStyleSheetCount++;      }    }  }  return result;}