def export_metadata():    
    
    folder = 'metadata'
    name = get_dataset_filename()
    
    # Create a metadata folder in the temp directory if it does not exist
    temp_working_folder = os.path.join(temp_workspace,folder)
    create_folder(temp_working_folder, True)
    
    # Set the destinion of the metadata export
    source = staging_feature_class
    raw_metadata_export = os.path.join(temp_working_folder,name + '_raw.xml')
    
    # Export the metadata
    arcpy.env.workspace = temp_working_folder
    installDir = arcpy.GetInstallInfo('desktop')['InstallDir']
    translator = installDir + 'Metadata/Translator/ARCGIS2FGDC.xml'
    arcpy.ExportMetadata_conversion(source, translator, raw_metadata_export)

    # Process: XSLT Transformation to remove any sensitive info or format
    destination = os.path.join(temp_working_folder,name + '.xml')    
    if os.path.exists(args.metadata_xslt):
        logger.info('Applying metadata XSLT: ' + args.metadata_xslt)
        arcpy.XSLTransform_conversion(raw_metadata_export, args.metadata_xslt, destination, '')
        
        # Reimport the clean metadata into the FGDB
        logger.debug('Reimporting metadata to file geodatabase ' + destination)
        arcpy.MetadataImporter_conversion(destination,staging_feature_class)        
    else:
        # If no transformation exists, just rename and publish the raw metadata
        logger.warn('Problem publishing dataset {0}. Metadata XSLT not found.'.format(args.dataset_name))        
        os.rename(raw_metadata_export, destination)
                
    # Publish the metadata to the download folder
    publish_file(temp_working_folder, name + '.xml','metadata')
Exports the feature class metadata to an xml file
dataset/ETHPy150Open opencolorado/OpenColorado-Tools-and-Utilities/Scripts/ArcGIS/10.0/Python/PublishOpenDataset.py/export_metadata