def transform_input_gfs(self, formatted_xslt): xslt_doc = etree.fromstring(formatted_xslt.encode('ascii')) xslt_obj = etree.XSLT(xslt_doc) xml_doc = etree.parse(self.input_gfs) result = xslt_obj(xml_doc) return str(result)
def transform_input_gfs(self, formatted_xslt): # log.info(formatted_xslt) xslt_doc = etree.fromstring(bytes(formatted_xslt, encoding='utf8')) xslt_obj = etree.XSLT(xslt_doc) xml_doc = etree.parse(self.input_gfs) result = xslt_obj(xml_doc) return str(result)
def __init__(self, configdict, section): Filter.__init__(self, configdict, section, consumes=FORMAT.etree_doc, produces=FORMAT.etree_doc) self.xslt_file_path = self.cfg.get('script') self.xslt_file = open(self.xslt_file_path, 'r') # Parse XSLT file only once self.xslt_doc = etree.parse(self.xslt_file) self.xslt_obj = etree.XSLT(self.xslt_doc) self.xslt_file.close()