Source
def select_next_sibling(self):
ret = pyNodeList()
for node in self:
n = node.next_all()
if isinstance(n, pyNode):
duplicated = False
if len(ret) != 0:
for r in ret:
if r == n:
duplicated = True
break
if not duplicated: ret.append(n)
elif isinstance(n, pyNodeList) and len(n) != 0:
for elem in n:
duplicated = False
if len(ret) != 0:
for r in ret:
if r == elem:
duplicated = True
break
if not duplicated: ret.append(elem)
if len(ret) == 1: return ret[0]
else: return ret