Forum: Radiant CMS Can radiant tags replace simple XSLT?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
2946e3fd11261f3241ac3b9a0889b525?d=identicon&s=25 dave4c03 (Guest)
on 2007-07-05 19:34
(Received via mailing list)
Can radiant tags replace simple XSLT?  For example, how would I create a
<mytable> tag that wrapped n <mycol> tags?
8802b1fa1b53e2197beea9454244f847?d=identicon&s=25 Sean Cribbs (Guest)
on 2007-07-05 19:42
(Received via mailing list)
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.

2946e3fd11261f3241ac3b9a0889b525?d=identicon&s=25 dave4c03 (Guest)
on 2007-07-05 19:57
(Received via mailing list)
I am trying to avoid XSLT if possible, I would like to leave XSLT behind

For a simple example, let us say a page contained the following radiant

And I wanted it to generate the following html:

Can custom radiant tags be constructed to do this?
8aeb5ff3546efc726bab713e4e572a40?d=identicon&s=25 Keymone (Guest)
on 2007-07-05 20:01
(Received via mailing list)
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.
2946e3fd11261f3241ac3b9a0889b525?d=identicon&s=25 dave4c03 (Guest)
on 2007-07-05 20:07
(Received via mailing list)
Personally, I agree with Martin Fowler on this matter.  See

Unless speed is critical I will simplicity whenever possible.
Bdf2290f0b1d87cb0853966e7e51606b?d=identicon&s=25 Andrew O'Brien (Guest)
on 2007-07-05 21:18
(Received via mailing list)
Hi Dave,

If you want to get away from XSLT but still want to keep this XML
you could always make an extension that defines a filter and keep your
data in a separate page part (so that the filter is only applied to that
data).  There's an example filter in the trunk:

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
the input text and outputs your final html.  So in that method you could
over the XML with REXML or Hpricot (or any other library) and handle the

Or the filter could run an XSLT transformation if one were so inclined.

2946e3fd11261f3241ac3b9a0889b525?d=identicon&s=25 dave4c03 (Guest)
on 2007-07-05 22:16
(Received via mailing list)
Thanks, there is no doubt in my mind that Haml is impressive!  If I was
only person involved I suspect that I would prefer that route.

However, I have to deal with people who only talk html and css.
the simplest solution is to embed radiant tags into the html (if I can
them to do the job).
8802b1fa1b53e2197beea9454244f847?d=identicon&s=25 Sean Cribbs (Guest)
on 2007-07-05 22:26
(Received via mailing list)

I agree with the other responses, but here's a sample of what you
might be able to do:

  <r:column />
  <r:column />

tag 'table' do |tag|
  returning do |output|
    output << "<table>"
    output << "<tr>" << tag.expand << "</tr>"
    output << "</table>"

tag 'table:column' do |tag|
  "<td>\n xxx\n</td>"

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.

Bdf2290f0b1d87cb0853966e7e51606b?d=identicon&s=25 Andrew O'Brien (Guest)
on 2007-07-05 22:53
(Received via mailing list)
I actually haven't tried HAML and SASS yet either -- the reason I linked
the SassFilter was that it's an example of an extension that implements
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

I guess no matter what you could use either the filter or radius tag
solution depending on what fits your situation best.

This topic is locked and can not be replied to.