nsCOMPtr<nsIURI> uri; doc->GetBaseURL(getter_AddRefs(uri));
nsIURI *uri = doc->GetBaseURL();
TX_CompileStylesheet(nsIDOMNode* aNode, txStylesheet** aStylesheet){    nsCOMPtr<nsIDOMDocument> document;    aNode->GetOwnerDocument(getter_AddRefs(document));    if (!document) {        document = do_QueryInterface(aNode);    }    nsCOMPtr<nsIDocument> doc = do_QueryInterface(document);    nsCOMPtr<nsIURI> uri;    doc->GetBaseURL(getter_AddRefs(uri));    nsCAutoString baseURI;    uri->GetSpec(baseURI);    nsRefPtr<txSyncCompileObserver> obs = new txSyncCompileObserver(uri);    NS_ENSURE_TRUE(obs, NS_ERROR_OUT_OF_MEMORY);    NS_ConvertUTF8toUCS2 base(baseURI);    nsRefPtr<txStylesheetCompiler> compiler =        new txStylesheetCompiler(base, obs);    NS_ENSURE_TRUE(compiler, NS_ERROR_OUT_OF_MEMORY);    nsresult rv = handleNode(aNode, compiler);    if (NS_FAILED(rv)) {        compiler->cancel(rv);        return rv;    }    rv = compiler->doneLoading();    NS_ENSURE_SUCCESS(rv, rv);        *aStylesheet = compiler->getStylesheet();    NS_ADDREF(*aStylesheet);    return NS_OK;}