Skip to content

Instantly share code, notes, and snippets.

@pavelpy
Last active October 18, 2019 11:39
Show Gist options
  • Save pavelpy/5887ee55f959811ac8efb56b1222ae72 to your computer and use it in GitHub Desktop.
Save pavelpy/5887ee55f959811ac8efb56b1222ae72 to your computer and use it in GitHub Desktop.
Transform an XML file using XSLT in Python
import lxml.etree as ET
dom = ET.parse(xml_filename)
xslt = ET.parse(xsl_filename)
transform = ET.XSLT(xslt)
newdom = transform(dom)
print(str(newdom))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment