final String DOM_CLASS = classGen.getDOMClass();
// Create new instance of DOM class
int index = cpg.addMethodref(DOM_IMPL, "<init>", "(I)V");
il.append(new NEW(cpg.addClass(DOM_IMPL)));
il.append(DUP);
il.append(DUP);
il.append(new PUSH(cpg, RTF_INITIAL_SIZE));
il.append(new INVOKESPECIAL(index));
// Overwrite old handler with DOM handler
index = cpg.addMethodref(DOM_IMPL,
"getOutputDomBuilder",
"()" + TRANSLET_OUTPUT_SIG);
il.append(new INVOKEVIRTUAL(index));
il.append(DUP);
il.append(methodGen.storeHandler());
// Call startDocument on the new handler
il.append(methodGen.startDocument());
// Instantiate result tree fragment
translateContents(classGen, methodGen);
// Call endDocument on the new handler
il.append(methodGen.loadHandler());
il.append(methodGen.endDocument());
// Check if we need to wrap the DOMImpl object in a DOMAdapter object
if (!DOM_CLASS.equals(DOM_IMPL_CLASS)) {
// new org.apache.xalan.xsltc.dom.DOMAdapter(DOMImpl,String[]);
index = cpg.addMethodref(DOM_ADAPTER_CLASS,
"<init>",
"("+DOM_IMPL_SIG+
"["+STRING_SIG+
"["+STRING_SIG+")V");
il.append(new NEW(cpg.addClass(DOM_ADAPTER_CLASS)));
il.append(new DUP_X1());
il.append(SWAP);
/*
* Give the DOM adapter an empty type mapping if the nodeset