Skip to content

Instantly share code, notes, and snippets.

@Ben1980
Last active April 19, 2020 13:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ben1980/f697e64e87bf50cfef51befcd0cd4eee to your computer and use it in GitHub Desktop.
Save Ben1980/f697e64e87bf50cfef51befcd0cd4eee to your computer and use it in GitHub Desktop.
from lxml import etree
import io
import sys
TAGfile = open(sys.argv[1]+"/Testing/TAG", 'r') #(1)
dirname = TAGfile.readline().strip()
xslfile = open(sys.argv[2], 'r')
xslcontent = xslfile.read()
xmldoc = etree.parse(sys.argv[1]+"/Testing/"+dirname+"/Test.xml") #(2)
xslt_root = etree.XML(xslcontent) #(3)
transform = etree.XSLT(xslt_root) #(4)
result_tree = transform(xmldoc) #(5)
print(result_tree)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment