Can radiant tags replace simple XSLT?

Can radiant tags replace simple XSLT? For example, how would I create a
tag that wrapped n tags?

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

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:



And I wanted it to generate the following html:

xxx xxx

Can custom radiant tags be constructed to do this?

Personally, I agree with Martin F. on this matter. See
http://www.martinfowler.com/bliki/MovingAwayFromXslt.html

Unless speed is critical I will simplicity whenever possible.

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.

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/extensions/sass_filter

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

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 << “


output << “” << tag.expand << “”
output << “

end
end

tag ‘table:column’ do |tag|

\n xxx\n”
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

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).

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs