When I struggled with this particular issue in a hobby-style-project, I used a datasource with XUL templates.
It was a huge pain to deal with RDF datasources. (I've heard there are alternatives now.) But it always seemed a very aesthetic way of handling things: separation of form and content etc.
I guess that breaks down when you want the resulting document to be as mutable as the rest of the page, though. :)
Posted by starwed at November 25, 2007 7:46 AMOne question is whether the two renderings will
a) have the same layout
b) have the same style but different layout (e.g. because they'll be reflowed with different available widths)
c) have different style and layout
For a), it would be pretty easy to add a new element/frame to Gecko that just "mirrors" the rendering of some other DOM subtree. This would be quite useful for various things, like live preview thumbnails.
(From Alex: I'd love to see it done - it'd obsolete the need for my synchronizer and, as I pointed out earlier, it wouldn't eat as much memory. If you want to file a bug for it, please cc me. I'd take a XPI as well.
There's the obvious weakness with separate nodes in that CSS can force different renderings, especially with carefully designed selectors.)
Posted by Robert O'Callahan at November 25, 2007 1:34 PM> How do you show the same data in two places at once, in Mozilla?
It's XForms.
(From Alex: You'll have to do better than that. A code snippet would be nice.
Besides, most Mozilla users don't have XForms installed by default.)
Posted by Alexander at November 28, 2007 10:02 PM> It's XForms.
> (From Alex: You'll have to do better than that. A
> code snippet would be nice.
This will show two 'hello' labels. Here xf:output elements are attached to 'data' element in instance document. If you change 'data' element by DOM methods then you need refresh model yourself (by calling methods on xf:model via JS) but if you do this by another xforms elements (it's usual way for XForms) then it will be updated automatically.
<xf:model>
<xf:instance>
<instanceData xmlns="">
<data>Hello</data>
</instanceData>
</xf:model>
<xf:output ref="/instanceData/data"/>
<xf:output ref="/instanceData/data"/>
> Besides, most Mozilla users don't have XForms
> installed by default.)
That's major restriction of XForms. Probably XForms is an excellent thing for XUL based applications or HTML applications targeted on intranet.
Posted by Alexander at December 3, 2007 3:30 AM