select_lang

returns elements that have the lang attribute and the given value.

Arguments

Source


def select_lang(self, lang):
    ret = pyNodeList()
    for node in self:
        l = node.attr('lang')
        if l is not None and l == lang:
            ret.append(node)
    if len(ret) == 1: return ret[0]
    else: return ret