//--- get metadata info and create an env that works with oai translators
final Metadata metadata = context.getBean(MetadataRepository.class).findOne(id);
String schemaDir = sm.getSchemaDir(metadata.getDataInfo().getSchemaId());
final String baseUrl = context.getBaseUrl();
final ISODate changeDate = metadata.getDataInfo().getChangeDate();
final String uuid = metadata.getUuid();
final String siteURL = context.getBean(SettingManager.class).getSiteURL(context);
final String siteName = gc.getBean(SettingManager.class).getSiteName();
Element env = Lib.prepareTransformEnv(uuid, changeDate.getDateAndTime(), baseUrl, siteURL, siteName);
//--- transform the metadata with the created env and specified stylesheet
return Lib.transform(schemaDir, env, elMd, styleSheet);
}