Source
def select_prev_sibling(self):
ret = pyNodeList()
for node in self:
n = node.prev_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)
else:
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