On Jul 26, 2004, at 1:35 Uhr, James Britt wrote: > Florian Weber wrote: >>> As for your example - I hope you realize the example is awkward >>> itself >>> :) No matter which framework you choose, the solution will always be >>> complicated and ugly. And yes, you can do this in cgikit :) >> not really. >> <a href="foo" style="color: <%= (@some_stuff > 3) ? 'red' : 'black' >> %>">foo</a> >> how would you do this in xml? > > Replace the stuff that makes XML parsers unhappy. > > <a href="foo" > style="color: <%= (@some_stuff > 3) ? > 'red' : 'black' %> " >foo</a> i meant how to describe the condition in a xml template language, not how to escape the stuff in xml =) > It's fugly, though most templating formats have that problem anyway. > > Most of them force a mix of disharmonious markup: not XML, not HTML, > not anything consistent with the document markup. If your main focus > is on the (X)HTML, and you try to use a fairly conventional HTML or > XML editor, the <%template sqiggles%> just get in the way. > > In the above example, since the XML is just a way of structuring > the data (i.e., there are no elements that have special meaning to > some other process, other than a web browser), one could do this > > <?EXP (@some_stuff > 3) ? 'red' : 'black' ?> > <a href="foo" style="color: EXP " >foo</a> > > on the assumption that some process knows that when it find a PI, it > replaces that next occurence of the PI target (here 'EXP') with the > eval'ed results of the PI data. > > It makes it a bit more friendly to designers and editing tools. > > My particular preference for templating tools is something that lets > me check the validity of code and markup independent of each other > (knowing, of course, that the combined results must also at some point > be checked). I'd rather not have to "compile" a page each time I want > to verify that HTML attributes are properly quoted, or that there are > no syntax errors in the code. > > James > > > > > > > >