Forum: Ruby on Rails Best practice advice

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
4c3f6ae3543413647e6b3734c184f017?d=identicon&s=25 Paul Butcher (paulbutcher)
on 2005-12-11 17:15
All,

I am currently investigating the rewrite of a PHP app in Rails.

One of the few reasonably well designed bits of the PHP app in question
is its rendering layer, which transforms XML generated by the app into
XHTML via XSLT.

I am aware that few existing Rails apps make use of XSLT, but in the
interests of not biting off more than I can chew I'd quite like to
replace the PHP generating the XML while keeping the XSLT in place.

I am confident that I know how to create a Rails app which generates XML
instead of HTML. I'm not confident that I know how to best convert that
XML into XSLT. I would very much appreciate guidance on how to approach
this.

I am aware of the RAA ruby-xslt project, but am not sure if this is the
best place for me to start. Unfortunately the homepage
http://www.rubyfr.net/ is currently down, which doesn't help, and I
notice that others have experienced problems getting it to work:

http://www.ruby-forum.com/topic/34085

Are there any other avenues that I should be exploring? Does anyone have
an example of a Rails app which utilises XSLT that I could see?

Thanks in advance for your help!

paul.butcher->msgCount++

Snetterton, Castle Combe, Cadwell Park...
Who says I have a one track mind?
71f1b6b2c3fd9af2e8c52618fb91caa6?d=identicon&s=25 Jules Jacobs (jules)
on 2005-12-11 17:28
It will be much easier to convert the whole application. Generating the
XML with rails will be harder than generating HTML directly. I would use
ERB templates instead of XSLT.

ps.

This is wrong:
paul.butcher->msgCount++

It should be:

paul.butcher.msg_count += 1
or
paul.butcher.msg_count.next!

;-)
4c3f6ae3543413647e6b3734c184f017?d=identicon&s=25 Paul Butcher (paulbutcher)
on 2005-12-11 23:56
Jules Jacobs wrote:
> It will be much easier to convert the whole application. Generating the
> XML with rails will be harder than generating HTML directly. I would use
> ERB templates instead of XSLT.

I very much hope that this isn't the only option - because if it is,
we'll be sticking with PHP :-(

At present, the XML that we generate is very simple and straightforward.
I know that I can put together something in Ruby which will generate it
very easily. On the other hand, the XSLT which then turns it into XHTML
is not straightforward. It will take a long time for me to pick it apart
to the point where I understand it well enough to be able to replicate
its functionality (whether in ERB or anything else).

I would certainly like to do this. But if I *have* to do it in order to
move to Ruby then we won't move to Ruby :-( I need to find a way to move
piecemeal if its going to happen.

> This is wrong:
> paul.butcher->msgCount++
>
> It should be:
>
> paul.butcher.msg_count += 1
> or
> paul.butcher.msg_count.next!
>
> ;-)

:-)

That signature has served me very well for very many years, during which
time I've programmed in assembly, Basic, Forth, Pascal, C, C++, occam,
Smalltalk, Ada, Linda, Russell, Java, Dylan, Haskell, Perl, Lisp, ML,
Javascript, Python, shell scripts, batch files, PHP, a couple of
languages which never got as far as having names and several others that
I can't remember just now. Ruby is going to have to be *really* good to
persuade me to change :-)
This topic is locked and can not be replied to.