用python libxml libxs
用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
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
相关文章