def applyXslt(self, xslStylesheet, topLevelParams=None, extFunctionMap=None, baseUri='file:', styleSheetCache=None): extFunctionMap = extFunctionMap or {} from Ft.Xml.Xslt.Processor import Processor processor = Processor() if styleSheetCache: styleSheet = styleSheetCache.getValue(xslStylesheet, baseUri) processor.appendStylesheetInstance(styleSheet, baseUri) else: processor.appendStylesheet( InputSource.DefaultFactory.fromString( xslStylesheet, baseUri)) #todo: fix baseUri for (k, v) in extFunctionMap.items(): namespace, localName = k processor.registerExtensionFunction(namespace, localName, v) return processor.runNode(self.dom, None, 0, topLevelParams), processor.stylesheet
def get_processor(self): proc = Processor() if self.extensions: for ext in self.extensions: proc.registerExtensionFunction(*(ext)) return proc