# Ruby and XSLT

**URL:** <https://www.ruby-forum.com/t/ruby-and-xslt/78863>\
**Category:** Ruby\
**Created:** [March 9, 2006, 4:11am UTC](https://www.ruby-forum.com/t/ruby-and-xslt/78863 "2006-03-09T04:11:04Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Derek\_Mahar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b5a626/32.png) [@Derek\_Mahar](https://www.ruby-forum.com/u/Derek_Mahar)\
**Post date:** [March 9, 2006, 4:11am UTC](https://www.ruby-forum.com/t/ruby-and-xslt/78863/1 "2006-03-09T04:11:04Z")

</div>

What Ruby libraries are available to parse and process XSLT? How does  
each of these libraries compare to Apache Xalan for Java?

Derek

---

<div class="post-metadata">

**Author:** ![Derek\_Mahar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b5a626/32.png) [@Derek\_Mahar](https://www.ruby-forum.com/u/Derek_Mahar)\
**Post date:** [March 9, 2006, 4:44am UTC](https://www.ruby-forum.com/t/ruby-and-xslt/78863/2 "2006-03-09T04:44:13Z")

</div>

[http://raa.ruby-lang.org/project/ruby-xslt/](http://raa.ruby-lang.org/project/ruby-xslt/)  
Ruby/XSLT is a simple XSLT class based on libxml [http://xmlsoft.org/](http://xmlsoft.org/)  
and libxslt [http://xmlsoft.org/XSLT/](http://xmlsoft.org/XSLT/)

---

<div class="post-metadata">

**Author:** ![Derek\_Mahar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b5a626/32.png) [@Derek\_Mahar](https://www.ruby-forum.com/u/Derek_Mahar)\
**Post date:** [March 15, 2006, 1:32pm UTC](https://www.ruby-forum.com/t/ruby-and-xslt/78863/3 "2006-03-15T13:32:45Z")

</div>

I am trying to use ruby-xslt under windows.  
Is this possible?  
The install instructions seem to be for \*nix only and my french isn’t  
very good.

---

<div class="post-metadata">

**Author:** ![Derek\_Mahar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b5a626/32.png) [@Derek\_Mahar](https://www.ruby-forum.com/u/Derek_Mahar)\
**Post date:** [March 15, 2006, 3:27pm UTC](https://www.ruby-forum.com/t/ruby-and-xslt/78863/4 "2006-03-15T15:27:03Z")

</div>

After more searching on forums and other pages it seems that ruby-xslt  
is very hard to install under windows. Has anyone done it before and  
could point me to some instructions?

Alternativly does anyone know of another way that is easier to install  
under windows. I want to do a very simple xslt transform, that reads in  
a series of XML files and produces a series of html files. I am dipping  
my toes into new water as i don’t know a huge amount about ruby or xslt.

thanks all

---

<div class="post-metadata">

**Author:** ![Derek\_Mahar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b5a626/32.png) [@Derek\_Mahar](https://www.ruby-forum.com/u/Derek_Mahar)\
**Post date:** [March 15, 2006, 4:26pm UTC](https://www.ruby-forum.com/t/ruby-and-xslt/78863/5 "2006-03-15T16:26:02Z")

</div>

toby wrote:

> After more searching on forums and other pages it seems that ruby-xslt  
> is very hard to install under windows. Has anyone done it before and  
> could point me to some instructions?
> 
> Alternativly does anyone know of another way that is easier to install  
> under windows. I want to do a very simple xslt transform, that reads in  
> a series of XML files and produces a series of html files. I am dipping  
> my toes into new water as i don’t know a huge amount about ruby or xslt.

If your tranformations are really simple,  
[MovingAwayFromXslt](http://www.martinfowler.com/bliki/MovingAwayFromXslt.html) might inspire  
you.

For instance, I didn’t find any sound Ruby alternative to Perl’s  
HTML::Template (anything with similar logic and usage: I want to have my  
templates Perl-compatible/to-Perl-transformable as far as possible),  
thus I have used this approach to write my own one (a very simple  
“subset”, of course). It has been easy and the code is short, but quite  
powerful, at least quite enough for me.

P.

---

<div class="post-metadata">

**Author:** ![Derek\_Mahar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b5a626/32.png) [@Derek\_Mahar](https://www.ruby-forum.com/u/Derek_Mahar)\
**Post date:** [March 15, 2006, 3:42pm UTC](https://www.ruby-forum.com/t/ruby-and-xslt/78863/6 "2006-03-15T15:42:30Z")

</div>

On 3/15/06, toby [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> After more searching on forums and other pages it seems that ruby-xslt  
> is very hard to install under windows. Has anyone done it before and  
> could point me to some instructions?
> 
> Alternativly does anyone know of another way that is easier to install  
> under windows. I want to do a very simple xslt transform, that reads in  
> a series of XML files and produces a series of html files. I am dipping  
> my toes into new water as i don’t know a huge amount about ruby or xslt.

You might be better off to use Apache Xalan or Saxon. Both are  
implemented in Java and both can be invoked from the command-line. You  
could run them from a Ruby script.

---

<div class="post-metadata">

**Author:** ![Derek\_Mahar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b5a626/32.png) [@Derek\_Mahar](https://www.ruby-forum.com/u/Derek_Mahar)\
**Post date:** [March 15, 2006, 4:59pm UTC](https://www.ruby-forum.com/t/ruby-and-xslt/78863/7 "2006-03-15T16:59:29Z")

</div>

thanks, guys. I’ll take a look at Xalan and see what i can do.

---

<div class="post-metadata">

**Author:** ![Derek\_Mahar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b5a626/32.png) [@Derek\_Mahar](https://www.ruby-forum.com/u/Derek_Mahar)\
**Post date:** [March 15, 2006, 5:12pm UTC](https://www.ruby-forum.com/t/ruby-and-xslt/78863/8 "2006-03-15T17:12:48Z")

</div>

On Wed, 2006-03-15 at 23:27 +0900, toby wrote:

> Alternativly does anyone know of another way that is easier to install  
> under windows. I want to do a very simple xslt transform, that reads in  
> a series of XML files and produces a series of html files. I am dipping  
> my toes into new water as i don’t know a huge amount about ruby or xslt.

Not that this is much help right now, but I recently did some work  
bringing ruby-libxslt bindings up to date, as part of the ruby-libxml  
project. Hopefully we’ll be making a release imminently, and would very  
much like to hear how it does with Windows (it should be fine but I  
can’t be sure…)

If you really want you could grab the code from CVS. See:

```
http://rubyforge.org/scm/?group_id=494

```

If you do that, check out the whole repository because libxslt-ruby  
depends on headers from libxml-ruby.

---

<div class="post-metadata">

**Author:** ![Derek\_Mahar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b5a626/32.png) [@Derek\_Mahar](https://www.ruby-forum.com/u/Derek_Mahar)\
**Post date:** [May 21, 2008, 12:18am UTC](https://www.ruby-forum.com/t/ruby-and-xslt/78863/9 "2008-05-21T00:18:07Z")

</div>

I experiment Saxon9, invoked by the command line.

It works pretty well and permits to use XSLT 2.0 abilities (group-by)  
and saxon:evaluate()
