def to_csv(self, sort=True, path=None, select_columns=None):
    'Export table from xml engine to CSV file.'
    for table_item in self.script_table_registry[self.script.name]:
        header = table_item[1].get_insert_columns(join=False, create=True)
        outputfile = os.path.normpath(os.path.join((path if path else ''), (os.path.splitext(os.path.basename(table_item[0]))[0] + '.csv')))
        empty_rows = 1
        if hasattr(self.script, 'empty_rows'):
            empty_rows = self.script.empty_rows
        input_file = table_item[0]
        header_values = header
        csv_outfile = xml2csv_test(input_file, outputfile, header_values, row_tag='row')
        sort_csv(csv_outfile, encoding=self.encoding)
Export table from xml engine to CSV file.
def to_csv(self, sort=True, path=None, select_columns=None):
    
    for table_item in self.script_table_registry[self.script.name]:
        header = table_item[1].get_insert_columns(join=False, create=True)
        outputfile = os.path.normpath(os.path.join((path if path else ), (os.path.splitext(os.path.basename(table_item[0]))[0] + '.csv')))
        empty_rows = 1
        if hasattr(self.script, 'empty_rows'):
            empty_rows = self.script.empty_rows
        input_file = table_item[0]
        header_values = header
        csv_outfile = xml2csv_test(input_file, outputfile, header_values, row_tag='row')
        sort_csv(csv_outfile, encoding=self.encoding)