def get_xpath_from_uxpath(tixi, uxpath):
    """
    Function to determine the XPath belonging to a UXPath.

    :param tixi: tixi handle
    :type tixi: tixi
    :param uxpath: string with full UXPath
    :type uxpath: basestring
    :return: XPath of the UXPath
    :rtype: basestring
    """
    xpath_elements = uxpath.split('/')[1:]
    xpath_elements_rev = xpath_elements[::-1]
    uid = ''
    for idx, el in enumerate(xpath_elements_rev):
        if '[' in el and ']' in el:
            locator = el[el.find('[') + 1:el.rfind(']')]
            if not locator.isdigit():
                uid = locator
                break
    if len(uid) > 0:
        xpath = tixi.uIDGetXPath(uid)
        if xpath:
            if idx != 0:
                xpath = xpath + '/' + '/'.join(xpath_elements_rev[:idx][::-1])
        else:
            xpath = None
    else:
        xpath = uxpath
    return xpath
