def import_xml(self, filepath, prefix, resourcename, format):
        """
            Import XML data using an XSLT: static/formats/<format>/import.xsl
        """

        # Remove any spaces and enclosing double quote
        prefix = prefix.strip('" ')
        resourcename = resourcename.strip('" ')

        errorString = "prepopulate error: file %s missing"
        try:
            File = open(filepath, "r")
        except IOError:
            self.errorList.append(errorString % filepath)
            return

        stylesheet = os.path.join(current.request.folder,
                                  "static",
                                  "formats",
                                  format,
                                  "import.xsl")
        try:
            S = open(stylesheet, "r")
        except __HOLE__:
            self.errorList.append(errorString % stylesheet)
            return
        else:
            S.close()

        tablename = "%s_%s" % (prefix, resourcename)
        resource = current.s3db.resource(tablename)

        # Customise the resource
        customise = current.deployment_settings.customise_resource(tablename)
        if customise:
            request = S3Request(prefix, resourcename, current.request)
            customise(request, tablename)

        auth = current.auth
        auth.rollback = True
        try:
            resource.import_xml(File, stylesheet=stylesheet)
        except SyntaxError, e:
            self.errorList.append("WARNING: import error - %s (file: %s, stylesheet: %s/import.xsl)" %
                                 (e, filepath, format))
            auth.rollback = False
            return

        if not resource.error:
            current.db.commit()
        else:
            # Must roll back if there was an error!
            error = resource.error
            self.errorList.append("%s - %s: %s" % (
                                  filepath, tablename, error))
            errors = current.xml.collect_errors(resource)
            if errors:
                self.errorList.extend(errors)
            current.db.rollback()

        auth.rollback = False

    # -------------------------------------------------------------------------
dataset/ETHPy150Open sahana/eden/modules/s3/s3import.py/S3BulkImporter.import_xml