XML/XSLT processors - XSLT4R not working?

I’m looking for a pure Ruby XSLT processor. Stumbled across XSLT4R.
It looks promising, but it doesn’t seem to work even for the test.xslt
in its test directory. I’d appreciate some recommendations in XSLT
processor for Ruby. Is there anything in Ruby similar to JAXP in Java?

Thanks
Chris “the XSLT newbie who would rather program in Ruby”

I’d suggest trying the libxslt wrapper (listed as ‘libxslt’ in the RAA).
I haven’t tried it in Ruby, but I’ve used the underlying C library, and
in my experience it is close to 100% conformance with the spec, and its
performance is competitive with MSXML (i.e. it’s damn good).

Of course, it does depend on a C library–two, actually, since libxslt
depends on libxml–so it’s less portable than a pure Ruby solution. But
it looks like precompiled binaries are now available for Windows as well
as POSIX platforms, so maybe it can be installed without too much agony
on most platforms.

···

On Mon, Oct 21, 2002 at 11:48:08PM +0900, Chris Wong wrote:

I’m looking for a pure Ruby XSLT processor. Stumbled across XSLT4R.
It looks promising, but it doesn’t seem to work even for the test.xslt
in its test directory. I’d appreciate some recommendations in XSLT
processor for Ruby. Is there anything in Ruby similar to JAXP in Java?


Matt Gushee When a nation follows the Way,
Englewood, Colorado, USA Horses bear manure through
mgushee@havenrock.com its fields;
http://www.havenrock.com/ When a nation ignores the Way,
Horses bear soldiers through
its streets.

                        --Lao Tzu (Peter Merel, trans.)

From: Chris Wong [mailto:chris_wong@mac.com]
Sent: Monday, October 21, 2002 7:48 AM
To: ruby-talk ML
Subject: XML/XSLT processors - XSLT4R not working?

I’m looking for a pure Ruby XSLT processor. Stumbled across XSLT4R.
It looks promising, but it doesn’t seem to work even for the test.xslt
in its test directory. I’d appreciate some recommendations in XSLT
processor for Ruby. Is there anything in Ruby similar to JAXP in Java?

Here are some choices for XSLT in Ruby, though they do not fit a "pure Rby"
requirement.
The descriptions are taken from the either the RAA entry or the owner’s web
site.

sablot http://www.rubycolor.org/sablot/
This is a Ruby interface to Sablotron, the XSLT processor developed by
Ginger Alliance. Requires Sablotron binary or compiled source

ruby-libxslt http://www.rubynet.org/modules/xml/ruby-libxslt/
A working, fully compliant, XSLT engine for Ruby. This module is still under
heavy development and requires libxml, however it is very functional and is
feature complete for the XSLT spec. Requires libxml (binary or compiled from
source)

James

···

-----Original Message-----

Thanks
Chris “the XSLT newbie who would rather program in Ruby”

I’m looking for a pure Ruby XSLT processor. Stumbled across XSLT4R.
It looks promising, but it doesn’t seem to work even for the test.xslt
in its test directory. I’d appreciate some recommendations in XSLT
processor for Ruby. Is there anything in Ruby similar to JAXP in Java?

Thanks
Chris “the XSLT newbie who would rather program in Ruby”

BTW, unless there is a special reason you need to use XSLT, you can do quite a
bit of XML transformation using a SAX or stream parser. If, for example, your
XML maps fairly linearly to your intended output, you can catch events for
particular elements, grab element and attribute values, and write to an output
stream or some variable. I did this on rubyxml.com, pulling database records as
XML and using the REXML stream parser to convert them into HTML. It’s basically
a template-populating device.

It arguably more efficient than using XSLT, assuming the XSLT processor needs to
read the entire source XML into memory, when transforming large but structurally
simple XML input.

I started out using Ruby and XSLT, but lack of full compliance with the W3C spec
threw me off, and I went and wrote a general-purpose XML-stream template thingy.

I wrote an article called “Stream Parsing with REXML”, here:
http://www.rubyxml.com/articles/REXML/Stream_Parsing_with_REXML

though I’ve likely changed my actual production code since then (and learned
more abut Ruby as well :] ).

James

Is there any known memory leak issues with libxml2, libxslt, salblotron
and expat (which salblotron uses to parse xml)?

I’m curious why there isn’t a strong need to create a pure Ruby xslt
processor based on maybe rexml? Is it because of performance issue?

BTW, ruby-libxml won’t link. I’ll notify the owner or submit a patch
later when I have time.

Chris

JamesBritt wrote:

From: Chris Wong [mailto:chris_wong@mac.com]
Sent: Monday, October 21, 2002 7:48 AM
To: ruby-talk ML
Subject: XML/XSLT processors - XSLT4R not working?

I’m looking for a pure Ruby XSLT processor. Stumbled across XSLT4R.
It looks promising, but it doesn’t seem to work even for the test.xslt
in its test directory. I’d appreciate some recommendations in XSLT
processor for Ruby. Is there anything in Ruby similar to JAXP in Java?

Here are some choices for XSLT in Ruby, though they do not fit a "pure
Rby"
requirement.
The descriptions are taken from the either the RAA entry or the
owner’s web
site.

sablot http://www.rubycolor.org/sablot/
This is a Ruby interface to Sablotron, the XSLT processor developed by
Ginger Alliance. Requires Sablotron binary or compiled source

ruby-libxslt http://www.rubynet.org/modules/xml/ruby-libxslt/
A working, fully compliant, XSLT engine for Ruby. This module is
still under
heavy development and requires libxml, however it is very functional
and is
feature complete for the XSLT spec. Requires libxml (binary or
compiled from

···

-----Original Message-----
source)

James

Thanks
Chris “the XSLT newbie who would rather program in Ruby”

I’m curious why there isn’t a strong need to create a pure Ruby xslt
processor based on maybe rexml? Is it because of performance issue?

Performance is definitely the issue. XSLT is a hugely expensive
process can take hours for very large documents and extremely
complex stylesheets even when using strait C libxslt. On the other
hand, if your documents are simple, XSLT can be nice an snappy.

As a point of reference, libxslt is exceedingly fast for XSLT
processors. I am currently parsing the RAA xml feed, which is 656KB
in size and am applying a stylesheet to it in 0.346255 seconds using
libxslt. Hopefully that’s fast enough for most folks. :slight_smile:

BTW, ruby-libxml won’t link. I’ll notify the owner or submit a
patch later when I have time.

You can find a link to the libxml bindings off of the rubynet.org
site or under:

http://www.rubynet.org/modules/xml/libxslt/

To the real power XML users: variables/parameters are coming soon.

-sc

···


Sean Chittenden