def traverse_xsyn(element, on_element):
    """
    .. function: traverse_xsyn  traverses element and returns concatenated lists of calling on_element of each element.

        :param  element     element in DOM.
        :param  on_element  callback on element that returns list of values.
    """
    res = on_element(element)
    for child in element.childNodes:
        child_results = traverse_xsyn(child, on_element)
        res += child_results
    return res