Cryptic title isn't it ? Rendering in this context refers to the translation of OPML format outlines to regular HTML pages viewable in Web browsers. That is activeRenderer's main job.
Transclusion refers to the expansion in place of outline nodes that link to other OPML resources over the Web so that linked contents become seamlessly integrated into the current document. Still interested ?
The UserTalk version of activeRenderer performs its trick when the original OPML outline is upstreamed to the public server.
To achieve transclusion in the browser, I needed an 'on the fly' rendering feature, completely separate from the Radio application: a lot of people reading outline rendered pages are not running Radio at all.
So I wrote an XSLT version of activeRenderer, and relied on an external W3C provided CGI like service for the 'instant' rendering. It works pretty well, as you can check from this demo. I chose not to rely on the browser for the XSL transform, since only MSIE 6 for Windows has half decent XSLT support. Recent Mozilla versions are even buggier when it comes to their XSL engine.
The next step was to write a 'transclude' Javascript function that gets invoked every time the OPML renderer hits a 'url' attribute with a '.opml' extension.
Relying heavily on Javascript DOM level 1 API, this transclude code creates an (invisible) IFRAME element in the rendered page, then modifies its location property to a request url computed from the url of the W3C server, the url of the XSL transform script, and the url of the target OPML outline. Presto, the rendered HTML is retrieved.
Still leveraging the DOM API, all that remains is to access the root DIV element in the retrieved HTML, and visibly insert it under the node that featured the link to the OPML resource, with a little formatting along the way.
But OUCH, that's where the wall hits !
For Javascript, an iframe is a frame is a window. Accessing the contents of a window originating from one domain (the W3C server) from a window originating from another (the original rendered outline) is a clear violation of the cross window security barrier, and accordingly raises an exception.
Now the rendered link's content sits just there in the browser, but it's out of reach ! Why didn't I think of this in the first place ? #@%$ !!
I still haven't found a decent way around the problem.
Currently, I'm creating iframes every time an OPML link is clicked, and insert them in place. It kind of works with Mozilla, as this demo shows, but so far I haven't been able to achieve a result with MSIE.
All right, if you've taken the time to read this geeky rant, I would appreciate new ideas to crack the transclusion nut open.