用python libxml libxs
发布时间:2019-09-08 09:09:46编辑:auto阅读(2227)
用python libxml libxslt实现xml操作,最好能生成html文件,但是只要解决了xslt的问题就不难。
stylesheetArgs = {} # optional transform args
styleDoc = libxml2.parseDoc(docText) # <xml ...xsl:stylesheet >
style = libxslt.parseStylesheetDoc(styleDoc)
doc = libxml2.parseDoc(srcXML) # <xml input file>
result = style.applyStylesheet(doc,stylesheetArgs)
res = style.saveResultToString(result)
style.freeStylesheet()
doc.freeDoc()
result.freeDoc()
return res
关键字: