Can radiant tags replace simple XSLT? For example, how would I create a <mytable> tag that wrapped n <mycol> tags?
on 2007-07-05 19:34
on 2007-07-05 19:42
Yes and no. There are many available tags for manipulating content, but they primarily manipulate existing content in the CMS, i.e. pages, page-parts, snippets, and layouts. Can you give an example of the source you want to transform and the result of its transformation? Of course, there is always the possibility for a custom extension that processes XML and XSLT using libxml2/libexslt. That would be kind of neat, in fact. Sean
on 2007-07-05 19:57
I am trying to avoid XSLT if possible, I would like to leave XSLT behind me:) For a simple example, let us say a page contained the following radiant tags: <mytable> <mycol/> <mycol/> </mytable> And I wanted it to generate the following html: <table> <tr> <td> xxx </td> <td> xxx </td> </tr> <table> Can custom radiant tags be constructed to do this?
on 2007-07-05 20:01
just curious: isn't XSLT faster than any radiant template parser? XSLT is bad only in one thing - when it goes to dynamic data, you can't change input XML on fly but XSLT parser is really good idea for template language.
on 2007-07-05 20:07
Personally, I agree with Martin Fowler on this matter. See http://www.martinfowler.com/bliki/MovingAwayFromXslt.html Unless speed is critical I will simplicity whenever possible.
on 2007-07-05 21:18
Hi Dave, If you want to get away from XSLT but still want to keep this XML format, you could always make an extension that defines a filter and keep your XML data in a separate page part (so that the filter is only applied to that data). There's an example filter in the trunk: http://dev.radiantcms.org/radiant/browser/trunk/ex... and another extension that adds a filter on the 3rd party extension page (Maruku Filter I think?). In your filter class, you would define a "filter(text)" method that takes the input text and outputs your final html. So in that method you could run over the XML with REXML or Hpricot (or any other library) and handle the transformation. Or the filter could run an XSLT transformation if one were so inclined. -Andrew
on 2007-07-05 22:16
Thanks, there is no doubt in my mind that Haml is impressive! If I was the only person involved I suspect that I would prefer that route. However, I have to deal with people who only talk html and css. Therefore, the simplest solution is to embed radiant tags into the html (if I can get them to do the job).
on 2007-07-05 22:26
Dave, I agree with the other responses, but here's a sample of what you might be able to do: <r:table> <r:column /> <r:column /> </r:table> ---------------- tag 'table' do |tag| returning String.new do |output| output << "<table>" output << "<tr>" << tag.expand << "</tr>" output << "</table>" end end tag 'table:column' do |tag| "<td>\n xxx\n</td>" end Obviously that's very rough and just an outline of what you might want to do. If your end users are HTML/CSS proficient, then just use HTML! Radiant is nice in that it gets out of your way in terms of design. When you need something programmatic, then consider using Radius tags. Sean
on 2007-07-05 22:53
I actually haven't tried HAML and SASS yet either -- the reason I linked to the SassFilter was that it's an example of an extension that implements a filter. I may not be understanding your use-case correctly, but who or what is producing this XML? And why could they/it just use standard HTML tables? I guess no matter what you could use either the filter or radius tag solution depending on what fits your situation best. -Andrew