Infrequently Noted

Alex Russell on browsers, standards, and the process of progress.

No Joy

I just spent upwards of 3 hours attempting to get a functioning Python XSLT processor installed on my box so I can continue brainFeed development. What a fucking mess.

To start with, the latest versions of PyXML supposedly provides an xslt module (derived from 4XSLT) with a sane programatic interface. Unfortunantly, when it does decide to compile, it segfaults whenver you try to create an XSLT Processor object, and if there's some implicit dependency on 4XSLT, the docs ain't talkin. Worthless.

As for 4Suite proper, it DOES compile and install without problems, only it's programatic interface is a steaming pile. Instead of:

from xml.xslt.Processor import Processor
ssText = open('styleSheet.xsl').read()
datText = open('myData.xml').read()
xslt_proc = Processor()
xslt_proc.appendStylesheetString(ssText)
result = xslt_proc.runString(datText)

4XSLT makes you do this:

from Ft.Xml.Xslt import Processor
ssText = open('styleSheet.xsl').read()
datText = open('myData.xml').read()
xslt_proc = Processor.Processor()
xslt_proc.appendStylesheet(
  Ft.Xml.InputSource.DefaultFactory.fromString(ssText)
)
result = xslt_proc.run(
  Ft.Xml.InputSource.DefaultFactory.fromString(datText)
)

And no, those much longer interfaces don't appear to be documented. It took me an hour of reading source just to figure this much out. What a cluster.