def xpath_book(request, uuid, version, return_json=True):
    """
    Given a request, book UUID and version:

    returns a JSON object or HTML list of results, each result containing:
    module_name,
    module_uuid,
    xpath_results, an array of strings, each an individual xpath result.
    """

    xpath_string = request.params.get('q')
    results = execute_xpath(xpath_string, 'xpath', uuid, version)
    if return_json:
        return results
    else:
        return xpath_book_html(request, results)