def __xml_scan(node, env, path, arg):
    if not os.path.isfile(str(node)):
        return []
    if env.get('DOCBOOK_SCANENT',''):
        contents = node.get_text_contents()
        return sentity_re.findall(contents)
    xsl_file = os.path.join(scriptpath,'utils','xmldepend.xsl')
    if not has_libxml2 or prefer_xsltproc:
        if has_lxml and not prefer_xsltproc:
            from lxml import etree
            xsl_tree = etree.parse(xsl_file)
            doc = etree.parse(str(node))
            result = doc.xslt(xsl_tree)
            depfiles = [x.strip() for x in str(result).splitlines() if x.strip() != "" and not x.startswith("<?xml ")]
            return depfiles
        else:
            xsltproc = env.subst("$DOCBOOK_XSLTPROC")
            if xsltproc and xsltproc.endswith('xsltproc'):
                result = env.backtick(' '.join([xsltproc, xsl_file, str(node)]))
                depfiles = [x.strip() for x in str(result).splitlines() if x.strip() != "" and not x.startswith("<?xml ")]
                return depfiles
            else:
                contents = node.get_text_contents()
                return include_re.findall(contents)
    styledoc = libxml2.parseFile(xsl_file)
    style = libxslt.parseStylesheetDoc(styledoc)
    doc = libxml2.readFile(str(node), None, libxml2.XML_PARSE_NOENT)
    result = style.applyStylesheet(doc, None)
    depfiles = []
    for x in str(result).splitlines():
        if x.strip() != "" and not x.startswith("<?xml "):
            depfiles.extend(x.strip().split())
    style.freeStylesheet()
    doc.freeDoc()
    result.freeDoc()
    return depfiles