/ Published in: Python
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
import libxml2 import libxslt import sys if (len(sys.argv) != 4): print "Usage: "+sys.argv[0]+" xsltfile xmlfile outputfile" sys.exit(1) styledoc = libxml2.parseFile(sys.argv[1]) style = libxslt.parseStylesheetDoc(styledoc) doc = libxml2.parseFile(sys.argv[2]) result = style.applyStylesheet(doc, None) style.saveResultToFilename(sys.argv[3], result, 0) style.freeStylesheet() doc.freeDoc() result.freeDoc()