int init = cpg.addMethodref(SINGLETON_ITERATOR, "<init>", "("+NODE_SIG+")V"); il.append(new NEW(cpg.addClass(SINGLETON_ITERATOR))); il.append(DUP); il.append(methodGen.loadCurrentNode()); il.append(new INVOKESPECIAL(init));
il.append(methodGen.loadIterator());
    public void translate(ClassGenerator classGen, MethodGenerator methodGen) {	final Stylesheet stylesheet = classGen.getStylesheet();	final ConstantPoolGen cpg = classGen.getConstantPool();	final InstructionList il = methodGen.getInstructionList();	final int current = methodGen.getLocalIndex("current");	// Push the arguments that are passed to applyTemplates()	il.append(classGen.loadTranslet());	il.append(methodGen.loadDOM());	// Wrap the current node inside an iterator	int init = cpg.addMethodref(SINGLETON_ITERATOR,				    "<init>", "("+NODE_SIG+")V");	il.append(new NEW(cpg.addClass(SINGLETON_ITERATOR)));	il.append(DUP);	il.append(methodGen.loadCurrentNode());	il.append(new INVOKESPECIAL(init));	il.append(methodGen.loadHandler());        // Push a new parameter frame in case imported template might expect        // parameters.  The apply-imports has nothing that it can pass.        if (stylesheet.hasLocalParams()) {            il.append(classGen.loadTranslet());            final int pushFrame = cpg.addMethodref(TRANSLET_CLASS,                                                   PUSH_PARAM_FRAME,                                                   PUSH_PARAM_FRAME_SIG);            il.append(new INVOKEVIRTUAL(pushFrame));        }	// Get the [min,max> precedence of all templates imported under the	// current stylesheet	final int maxPrecedence = _precedence;	final int minPrecedence = getMinPrecedence(maxPrecedence);	final Mode mode = stylesheet.getMode(_modeName);        // Get name of appropriate apply-templates function for this        // xsl:apply-imports instruction	String functionName = mode.functionName(minPrecedence, maxPrecedence);	// Construct the translet class-name and the signature of the method	final String className = classGen.getStylesheet().getClassName();	final String signature = classGen.getApplyTemplatesSig();	final int applyTemplates = cpg.addMethodref(className,						    functionName,						    signature);	il.append(new INVOKEVIRTUAL(applyTemplates));        // Pop any parameter frame that was pushed above.        if (stylesheet.hasLocalParams()) {            il.append(classGen.loadTranslet());            final int pushFrame = cpg.addMethodref(TRANSLET_CLASS,                                                   POP_PARAM_FRAME,                                                   POP_PARAM_FRAME_SIG);            il.append(new INVOKEVIRTUAL(pushFrame));        }    }