NodeTest kind = new TypeTest(Type.ELEMENT);
// the elem must always be added at the front, so if there are
// already other items, we create a new one, add the elem, then
// add the original items after
if(result.isEmpty()) {
doc.selectChildren(kind, result);
} else {
final ValueSequence newResult = new ValueSequence();
doc.selectChildren(kind, newResult);
newResult.addAll(result);
result = newResult;