select_prev

returns elements that are previous element.

Source


def select_prev(self):
    ret = pyNodeList()
    for node in self:
        p = node.prev_element()
        if p is not None:
            duplicated = False
            if len(ret) != 0:
                for r in ret:
                    if r == p:
                        duplicated = True
                        break
            if not duplicated: ret.append(p)
    if len(ret) == 1: return ret[0]
    else: return ret