/ Published in: Python
Expand |
Embed | Plain Text
from lxml.etree import XSLT,fromstring xml = fromstring("<a key='value'>ez</a>") xsl= fromstring("""<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method = "html" version="1.0" encoding="UTF-8" omit-xml-declaration="yes" standalone="yes" indent="no" /> <xsl:template match="a"> <xsl:value-of select="@key"/> </xsl:template> </xsl:stylesheet>""") style = XSLT(xsl) result = style.apply( xml) print style.tostring(result)
You need to login to post a comment.
