Best practice advice


#1

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?


#2

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!

:wink:


#3

Jules J. 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 :frowning:

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 :frowning: 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!

:wink:

:slight_smile:

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 :slight_smile: