xsl_convert.py 文件源码

python
阅读 30 收藏 0 点赞 0 评论 0

项目:rtf2xml 作者: paulhtremblay 项目源码 文件源码
def __transform_4suite(self, file, xsl_file, output, params):

        import codecs
        from Ft.Xml import InputSource
        from Ft.Xml.Xslt.Processor import Processor

        document = InputSource.DefaultFactory.fromUri(file)
        stylesheet = InputSource.DefaultFactory.fromUri(xsl_file)
            # there's also a fromString() method

        processor = Processor()
        processor.appendStylesheet(stylesheet)  
        result = processor.run(document, topLevelParams=params)
        (utf8_encode, utf8_decode, utf8_reader, utf8_writer) = codecs.lookup("utf-8")
        write_obj = utf8_writer(open(output, 'w'))
        write_obj.write(result)
        write_obj.close()
        return result, ''
评论列表


问题


面经


文章

微信
公众号

扫码关注公众号