def get_applicable_styles(node):
    """
    Generates a list of dictionaries that contains all the styles that *could* influence the style of an element.

    This is the collection of all styles from an element and all it parent elements.

    Returns a list, with each list item being a dictionary with keys that correspond to CSS styles
    and the values are the corresponding values for each ancestor element.
    """
    styles = []
    for parent in node.xpath('ancestor-or-self::*[@style]'):
        style = parent.get('style', "")
        style = style.rstrip(";")

        if not style:
            continue

        styles.append(
            dict([
                tuple(
                    s.strip().split(':', 1)
                )
                for s in style.split(';')
            ])
        )
    return styles