final int gitr = cpg.addInterfaceMethodref(DOM_INTF,
"getIterator",
"()"+NODE_ITERATOR_SIG);
il.append(toplevel.loadDOM());
il.append(new INVOKEINTERFACE(gitr, 1));
il.append(toplevel.nextNode());
current.setStart(il.append(new ISTORE(current.getIndex())));
// Create a new list containing variables/params + keys
Vector varDepElements = new Vector(_globals);
Enumeration elements = elements();
while (elements.hasMoreElements()) {
final Object element = elements.nextElement();
if (element instanceof Key) {
varDepElements.add(element);
}
}
// Determine a partial order for the variables/params and keys
varDepElements = resolveDependencies(varDepElements);
// Translate vars/params and keys in the right order
final int count = varDepElements.size();
for (int i = 0; i < count; i++) {
final TopLevelElement tle = (TopLevelElement) varDepElements.elementAt(i);
tle.translate(classGen, toplevel);
if (tle instanceof Key) {
final Key key = (Key) tle;
_keys.put(key.getName(), key);
}
}
// Compile code for other top-level elements
Vector whitespaceRules = new Vector();
elements = elements();
while (elements.hasMoreElements()) {
final Object element = elements.nextElement();
// xsl:decimal-format
if (element instanceof DecimalFormatting) {
((DecimalFormatting)element).translate(classGen,toplevel);
}
// xsl:strip/preserve-space
else if (element instanceof Whitespace) {
whitespaceRules.addAll(((Whitespace)element).getRules());
}
}
// Translate all whitespace strip/preserve rules
if (whitespaceRules.size() > 0) {
Whitespace.translateRules(whitespaceRules,classGen);
}
if (classGen.containsMethod(STRIP_SPACE, STRIP_SPACE_PARAMS) != null) {
il.append(toplevel.loadDOM());
il.append(classGen.loadTranslet());
il.append(new INVOKEINTERFACE(setFilter, 2));
}
il.append(RETURN);
// Compute max locals + stack and add method to class