Sunday, November 22, 2009

QtWebKit and XSLT

Qt 4.6 is getting closer and there is a couple of optional features in Arora that are only enabled when building against the upcoming version, most of which have been blogged about. These basically required specific APIs to be available in QtWebKit. There are, however, certain new things in QtWebKit that did not need any additional work in Arora itself and work out of the box when running Qt 4.6. One of them is basic XSLT support.

So far, QtWebKit did not have any support for XSLT. Other WebKit ports have been using the libxslt library to handle XSL transformations, but for QtWebKit such a dependency would not have been possible and the XSLT processor in WebCore had been disabled in the build system (it didn't even compile). But since Qt developed its own XSLT processor in the QtXmlPatterns module, it's been possible to make QtWebKit use that. After a bit of abstraction work, the main patch landed in r48826.

Here is the other side of the medal: the set of XSLT features that are supported in QtWebKit supports corresponds to what is available in QtXmlPatterns, which is quite limited. Most of websites, which make use of XSLT to e.g. transform XML to a human-readable XHTML document, will most likely not work properly. This is, however, a good starting point towards better website compatibility. And at least most of the W3C Schools examples work just fine.