+ styledoc = libxml2.parseFile(filepath)
+ style = libxslt.parseStylesheetDoc(styledoc)
+ doc = libxml2.parseDoc(rspec)
+ result = style.applyStylesheet(doc, None)
+ if (output_xpath_filter):
+ p = result.xpathNewContext()
+ xpath_result = p.xpathEval(output_xpath_filter)
+ if (xpath_result == []):
+ raise Exception("Could not apply processor %s."%processor)
+
+ stylesheet_result = xpath_result[0].content
+ p.xpathFreeContext()
+ else:
+ stylesheet_result = style.saveResultToString(result)
+
+ style.freeStylesheet()
+ doc.freeDoc()
+ result.freeDoc()
+
+ return stylesheet_result
+
+ def wrap_up(self, rspec):
+ filepath = os.path.join(sfatables_config, 'processors', self.final_processor)
+
+ if not os.path.exists(filepath):
+ # TODO: final_processor is not there yet
+ return rspec
+