'Write <html filename="" [meta-attrs="..."]> to filename.xml, and the html
string to filename.html.'

def definition_to_xml(self, resource_fs):

    pathname = name_to_pathname(self.url_name)
    filepath = u'{category}/{pathname}.html'.format(category=self.category, pathname=pathname)
    resource_fs.makedir(os.path.dirname(filepath), recursive=True, allow_recreate=True)
    with resource_fs.open(filepath, 'w') as filestream:
        html_data = self.data.encode('utf-8')
        filestream.write(html_data)
    relname = path(pathname).basename()
    elt = etree.Element('html')
    elt.set('filename', relname)
    return elt
