So far, not a lot – though not for lack of trying.
Companion 0.1 converts skins to XSL, applies the XSL to the XML, chops the result into lots of small pieces, and inserts them back into the skin (all using JavaScript). At the time this seemed like the best way of doing it – rapid prototyping, quick feedback when something was broken (get no output back), let me brush up on my XSL.
This approach also has drawbacks. The first one being the feedback when something doesn’t work as expected – there’s only one sort of error that gets returned which doesn’t help. When ‘new’ skin tags are processed, the XSL can’t handle it and dies. This is one of many situations I’d like to flag, so that an appropriate error message can displayed to the user. It also offers no flexibility in output – e.g. dates are always output in UK format, even for US users. Both of these (and others) could be included in the current setup, but with significant performance penalties, because each JS->XSL->JS roundtrip involves converting a JavaScript ’string’ into an XML ‘document’, and the resulting XML ‘document’ into a JavaScript ’string’. This conversion is the slowest part of the whole process, despite the fact it’s been optimised as far as possible (I process the entire XML file at once. The original design had a seperate pass for each profile, which kept RAM usage down, but took about 20x longer).
So I decided to rip out the XSL and take advantage of Mozilla’s support for E4X (EcmaScript for XML). E4X basically extends the JavaScript language to have native support for handling XML. Being a very new addition to the engine, it’s largely untested and my first line of E4X exposed two bugs in Mozilla’s implementation that have kept me back.
Bug #1 (Mozilla bug #324422): A crash when reading the XML into memory.
Bug #2 (Mozilla bug #324844): A limit of 4Mb on any native JS object.
The Mozilla devs are taking both issues seriously – the 1st one is already has a ‘fix’ and the 2nd is being worked on. Both are likely to be marked as ’stop-ship’ bugs for the next version.
Who said open source isn’t great?