Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Ruby/XSLT
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  10 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Bill Walton  
View profile  
 More options Aug 20 2006, 11:07 am
From: "Bill Walton" <bill.wal...@charter.net>
Date: Sun, 20 Aug 2006 10:07:45 -0500
Local: Sun, Aug 20 2006 11:07 am
Subject: Ruby/XSLT

Anybody got any experience using this ( http://greg.rubyfr.net/pub/packages/ruby-xslt/files/README.html ) ?  I asked my hosting company (a2hosting.com) about XSLT processors for Rails and mentioned this one.  Four hours later I get email that they've installed it.  Thing is, the documentation didn't generate, and when I execute 'gem list --local' it's not listed as an installed gem.

Any info would really be appreciated.

Thanks,
Bill


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Stef T  
View profile  
 More options Aug 20 2006, 11:53 am
From: Stef T <s...@ummon.com>
Date: Sun, 20 Aug 2006 11:53:00 -0400
Subject: Re: [Rails] Ruby/XSLT

Hello Bill,
    Well, from the completely cursory glance given to it, it appears to
be a front end to libxslt. Basically, when I did this in perl (don't
hate ;), it was pretty much the same. Have your ruby program 'open' the
xml source file, open the xslt, apply the xslt (using the serve function
here) and then print out the output.

    What more info do you need ? (Honestly asked btw)
    Regards
    Stef
(ps. as with anything XSLT related, your going to spend about 4 days
getting your stylesheet correct, and 1 minute on the transformation
itself ;)


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Clayton Cottingham  
View profile  
 More options Aug 20 2006, 1:00 pm
From: Clayton Cottingham <dr.f...@shaw.ca>
Date: Sun, 20 Aug 2006 10:00:09 -0700
Local: Sun, Aug 20 2006 1:00 pm
Subject: RE: [Rails] Re: Ruby/XSLT
Agreed,

Making the xslt's will be the longest process, especially if you are new to
it.

Some books:
I would suggest picking up XSLT by WROX
And of course the pocket reference by orielly

If you need some help I wouldn't mind helping as I would like to look into
how ruby handles xml/xslt


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Bill Walton  
View profile  
 More options Aug 20 2006, 2:26 pm
From: "Bill Walton" <bill.wal...@charter.net>
Date: Sun, 20 Aug 2006 13:26:29 -0500
Local: Sun, Aug 20 2006 2:26 pm
Subject: Re: [Rails] Ruby/XSLT
Hi Stef,

Thanks for your response!  I'm going to change-up the order below a little
to make my reply read more easily.

Stef T wrote:
>    What more info do you need ? (Honestly asked btw)

I always presume goodwill ;-)

>    Well, from the completely cursory glance given to it, it appears to be
> a front end to libxslt.

And on libxml.  Are either / both of these included in Ruby or Rails?  If
so, which one?

> Have your ruby program 'open' the xml source file, open the xslt, apply
> the xslt (using the serve function here) and then print out the output.

I'm already wondering about the 'print out the output' part.  As a test, I
took a sample XML file and embedded the reference to the XSL file in it (
adding <?xml-stylesheet type="text/xsl"
href="stylesheets\ccr_xslt\ccr_20060328.xsl"?> as the second line of the
file).  Both FF and IE6 support this level of XSLT natively and opening the
XML file with either browser renders a correctly styled HTML page.

OTOH, when I do a 'render :file => "same XML file"' via my Rails controller,
the page renders but does not have the XSL applied.  If I do the render
:file on the translated HTML file, it renders that OK.  I don't understand
this and it worries me a little.  Based on the browsers' behavior when I
open the file through the File menu, it seems like this ought to work via
the render :file if Rails just passed the XML file through to the browser.
Any thoughts / ideas on what might be going on here and/or how to fix it
would be greatly appreciated!

Best regards,
Bill


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Bill Walton  
View profile  
 More options Aug 20 2006, 2:35 pm
From: "Bill Walton" <bill.wal...@charter.net>
Date: Sun, 20 Aug 2006 13:35:26 -0500
Local: Sun, Aug 20 2006 2:35 pm
Subject: Re: [Rails] Re: Ruby/XSLT
Hi Clayton,

Clayton Cottingham wrote:
> Making the xslt's will be the longest process,
> especially if you are new to it.

'Luckily', the XSLT's been furnished.  All I have to do is make it work ;-)

> Some books:
> I would suggest picking up XSLT by WROX
> And of course the pocket reference by orielly

I picked up the 'XSLT Quickly' from Manning a few weeks ago to get me
started.  Thanks for the suggestions, though, as (assuming I can get this
working) I'll be adding to that shorthly.

> If you need some help I wouldn't mind helping as I
> would like to look into how ruby handles xml/xslt

Excellent!!!  Please consider yourself asked.  I've got a feeling I'm
definitely going to need some help on this.  The biggest potential problem
I'm looking at at the moment is that I'm using InstantRails on WinXP for
development.  I was able to get my host (a2hosting.com) to install the
Ruby/XSLT gem for me, but the documentation didn't gen.  In fact, when I run
'gem list --local' I don't even see it.

I'll contact you off-list.  Thanks for offering.

Best regards,
Bill


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Bill Walton  
View profile  
 More options Aug 20 2006, 2:43 pm
From: "Bill Walton" <bill.wal...@charter.net>
Date: Sun, 20 Aug 2006 13:43:32 -0500
Local: Sun, Aug 20 2006 2:43 pm
Subject: Re: [Rails] Re: Ruby/XSLT
 Clarification for a poorly worded question ...

> And on libxml.  Are either / both of these included
> in Ruby or Rails?

If so, are they part of Ruby or Rails (so I'll know which documentation to
focus on) ?

Thanks,
Bill


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Stef T  
View profile  
 More options Aug 20 2006, 2:49 pm
From: Stef T <s...@ummon.com>
Date: Sun, 20 Aug 2006 14:49:41 -0400
Local: Sun, Aug 20 2006 2:49 pm
Subject: Re: [Rails] Ruby/XSLT

Hello Bill :)

Bill Walton wrote:
>>    What more info do you need ? (Honestly asked btw)

> I always presume goodwill ;-)

good way to be, a very good way, sometimes painful, but, *smiles* good
show :)
>>    Well, from the completely cursory glance given to it, it appears
>> to be a front end to libxslt.

> And on libxml.  Are either / both of these included in Ruby or Rails?  
> If so, which one?

If you mean are 'libxml' or 'libxslt' included in RoR, then no. These
are linux libraries. If you mean the 'ruby wrappers' (ruby-xml) come as
'standard', then no, however, there is a way to have rails generate out
xml by using a .rxml file. Have a look around
http://wiki.rubyonrails.org/rails/pages/HowtoGenerateXml ;)

Well, now, this is the interesting part :) Ideally, there should be a
sort of ':after_filter' on the method that you use to generate the XML.
Inside the :after_filter, you would load the stylesheet in much the same
way that the ruby-xsl shows. This way, your still using rails and you
have set the 'filter' to perform after the generation (so in the future,
if someone needs the un-translated XML, then can get it). The header
content-type would be different, but, you could probably change that
without too much trouble in the :after_filter ..

Thats my thinking. I am unsure if IE/FF include libxslt in there by
default, but, leaving this to the individual browser to deal with is
dangerous at best. Mean to say, your assuming that all XSLT engines will
follow 'the standard', whereas if you do the transformation yourself, at
least you know that the -exact- -same- structure of results is sent to
all clients.

Hopefully this makes sense, and I am interested in the solution you go
with. If its sufficiently 'weird', this could be a great problem to
distrac... urm.. occupy my work time tomorrow ;)

Regards as always
Stef


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Bill Walton  
View profile  
 More options Aug 20 2006, 3:37 pm
From: "Bill Walton" <bill.wal...@charter.net>
Date: Sun, 20 Aug 2006 14:37:32 -0500
Local: Sun, Aug 20 2006 3:37 pm
Subject: Re: [Rails] Ruby/XSLT
Hi Stef,

Thanks for your reply.

Stef T wrote:
> If you mean are 'libxml' or 'libxslt' included in RoR, then no. These are
> linux libraries. If you mean the 'ruby wrappers' (ruby-xml) come as
> 'standard', then no, however, there is a way to have rails generate out
> xml by ....

I'm using Builder to generate the XML file.

> Well, now, this is the interesting part :) Ideally, there should be a sort
> of ':after_filter' on the method that you use to generate the XML. Inside
> the :after_filter, you would load the stylesheet in much the same way that
> the ruby-xsl shows.

I'm not understanding the processing you describe in the :after_filter.
Load the stylesheet into what for use how?  Are you saying I can just
reference it with a stylesheet_tag or something and that somehow Rails would
then be able to handle it without an XSLT processor?

> leaving this to the individual browser to deal with is dangerous at best.
> Mean to say, your assuming that all XSLT engines will follow 'the
> standard', whereas if you do the transformation yourself, at least you
> know that the -exact- -same- structure of results is sent to all clients.

Agreed.  That's why I'm trying to get an XSLT processor working on my hosted
site.  In the meantime, I thought I'd see if I could just get Rails to pass
everything to the browser so I could at least get the results I get from the
browser's File menu.  No joy.  Let me know if you're interested and I'll be
more than happy to send you the XML and XSL files so you can see where I'm
having trouble understanding what Rails is doing.

Thanks again!

Best regards,
Bill


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Stef T  
View profile  
 More options Aug 20 2006, 6:02 pm
From: Stef T <s...@ummon.com>
Date: Sun, 20 Aug 2006 18:02:57 -0400
Local: Sun, Aug 20 2006 6:02 pm
Subject: Re: [Rails] Ruby/XSLT

Hey Bill :)

> Thanks for your reply.

Oh. you say that now, jst wait until you hear my solution :P (joking, I
hope ;)
>> Well, now, this is the interesting part :) Ideally, there should be a
>> sort of ':after_filter' on the method that you use to generate the
>> XML. Inside the :after_filter, you would load the stylesheet in much
>> the same way that the ruby-xsl shows.

> I'm not understanding the processing you describe in the
> :after_filter. Load the stylesheet into what for use how?  Are you
> saying I can just reference it with a stylesheet_tag or something and
> that somehow Rails would then be able to handle it without an XSLT
> processor?

Okay, well, in actioncontroller there is a way to 'hook in' processing
-after- a method has been called, jst before it returns the information
to the user (or the webpage to the browser if you prefer). This is done
by using the :after_filter. So, if you include the XSLT transformation
in there, then it will be called after everything else but before the
page is returned :)

I would -assume- something like

class blah < ActionController::Base

    require 'xml/xslt'

    after_filter :transformXMLUsingXSLT

    def myFunkyXMLGeneration
       # generate the XML page here
    end  

    private
    def transformXMLUsingXSLT
            # Should probably check the content header for XML ;P
            xslt = XML::XSLT.new()
            xslt.xml = @content
            xslt.xsl = "mytest.xsl"
            response.content = xslt.serve()
    end
end

This is by NO means -definitive- but, you should get an idea of what I
am driving at here ;>

>> leaving this to the individual browser to deal with is dangerous at
>> best. Mean to say, your assuming that all XSLT engines will follow
>> 'the standard', whereas if you do the transformation yourself, at
>> least you know that the -exact- -same- structure of results is sent
>> to all clients.

> Agreed.  That's why I'm trying to get an XSLT processor working on my
> hosted site.  In the meantime, I thought I'd see if I could just get
> Rails to pass everything to the browser so I could at least get the
> results I get from the browser's File menu.  No joy.  Let me know if
> you're interested and I'll be more than happy to send you the XML and
> XSL files so you can see where I'm having trouble understanding what
> Rails is doing.

Understandable, truly. The amount of times I have to try and thunk my
head around why something is designed the way it is, is normally the
part that takes 'time' :)

This is also in best interest's to fix, as even though I don't need this
right at this moment, I can see the need arising rather shortly where I
work ;)

Regards
Stef


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tony Arcieri  
View profile  
 More options Aug 30 2006, 8:39 pm
From: Tony Arcieri <rails-mailing-l...@andreas-s.net>
Date: Thu, 31 Aug 2006 02:39:10 +0200
Local: Wed, Aug 30 2006 8:39 pm
Subject: Re: Ruby/XSLT

Bill Walton wrote:
> Four hours later I get email that they've
> installed it.  Thing is, the documentation didn't generate, and when I
> execute 'gem list --local' it's not listed as an installed gem.

It hasn't been gemified.  I just started using this too and really wish
there was a gem for deployment purposes.

Last month Chad Fowler gave a talk on making gems at our local Ruby
Users Group.  Maybe I'll try my hand at gemifying it.

Otherwise, any volunteers? :)

--
Posted via http://www.ruby-forum.com/.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »