In Python, libxml and libxslt are my personal choice for this kind of function.
(Edit) libxml libxslt:
import sys
import libxml2
import libxslt
def getXSLT(xsl_filename):
styledoc = libxml2.parseFile(xsl_filename)
style = libxslt.parseStylesheetDoc(styledoc)
return style
if __name__ == '__main__':
style = getXSLT("stylesheet.xsl")
doc = libxml2.parseFile("data.xml")
result = style.applyStylesheet(doc, None)
print result