BuiltInAtomicType soughtItemType,
Set<BuiltInAtomicType> foundItemTypes,
XPathContext context,
boolean isFirst) throws XPathException {
//System.err.println("build index for doc " + doc.getDocumentNumber());
Pattern match = keydef.getMatch();
//NodeInfo curr;
XPathContextMajor xc = context.newContext();
// The use expression (or sequence constructor) may contain local variables.
SlotManager map = keydef.getStackFrameMap();
if (map != null) {
xc.openStackFrame(map);
}
SequenceIterator iter = match.selectNodes(doc, xc);
while (true) {
Item item = iter.next();
if (item == null) {
break;
}