Codesample for xml/xslt transforming
zanesdad at bellsouth.net
Tue Sep 9 16:27:41 CEST 2003
* Axel Straschil (axel at pizza.home.kosnet.com) wrote:
> I've test.xml, test.xsl or two vars with the code
> and wan't to transform it.
> Google just helped me for C ...
This code used to work (kinda ugly, though - sorry):
from Ft.Xml.Xslt.Processor import Processor
##I was working with a DOM object here
xml_data = dom.toxml()
processor = Processor()
f = open("rmkr.xsl",'r')
xsl_data = f.read()
result = processor.run(Ft.Xml.InputSource.DefaultFactory.fromString(str(xml_data), "uri"))
result_html = os.path.join(result_dir, "%s.html" % outfile_prefix)
htmlfile = open(result_html, "w")
I haven't tested it recently to see if it still works. It worked with FT under Python 2.1.
More information about the Python-list