private void prepareNextNode() throws XMLDBException, TransformerException, DBException {
node = null;
while (keyPos < keySet.length) {
DBDocument d = (DBDocument) context.getDocument(keySet[keyPos++]);
if (d == null) {
continue;
}
Node n = d.getDocumentElement();
XPathContext xpc = new XPathContext();
PrefixResolver pfx;
if (pr == null) {
pfx = new PrefixResolverDefault(d.getDocumentElement());
xp = new XPath(query, null, pfx, XPath.SELECT, errors);
} else {
pfx = pr;
if (xp == null) {
xp = new XPath(query, null, pfx, XPath.SELECT, errors);