def get_xpath_root(xpath):
    """ :return: the base of an XPATH: the part preceding any format keys or attribute references """

    if xpath:
        if xpath.startswith('@'):
            xpath = ''
        else:
            index = xpath.find('/@' if '@' in xpath else '/{')
            xpath = xpath[:index] if index >= 0 else xpath

    return xpath