Best way to do XSL to Ruby conversion (XSLT 2.0)

What is the best and most efficient way to do XSL to Ruby conversion? I tried Nokogiri, but no matter what I tried, it always results in:

compilation error: element stylesheet 

The stylesheet works fine in my XML editor.

I am using Ruby 1.9.3 for Linux.


After I popped up, I found out that Nokogiri does not support XSLT 2.0:

Nokogiri uses libxml2, which only supports XPath 1.0 / XSLT1.0

My stylesheet was written using XSLT 2.0 syntax. I updated the title of this question to reflect this. I want Nokogiri to answer this in a more meaningful way.

Why do you want to perform XSL conversion? Just curious.

I am working on a site that sends XML feeds to other sites. Each channel has a different format, but the data source for the channel is the same. So instead of writing custom code for each feed, I decided to use XSL stylesheets served from the database. That way, I can create new channels simply by loading a new stylesheet.

+6
ruby xml xslt nokogiri
source share
1 answer

In JRuby, you can use XSLT 2.0 with the saxony-xslt gem . I do not think that this can be done using other Ruby implementations. Of course, ruby ​​MP3 will depend on libxml, which XPath 2.0 has not yet implemented. See this thread for more details.

+4
source share

All Articles