XSLT and ecosystem help

Hi Guys,

Newbe. This should be a simple one.

I’m trying to work out an XSLT transform. Nokogiri somehow seems like
the only option… but I’m having trouble at just properly loading and
spitting out XML from files. Printing them out, I just get the first
line of the XML files instead of the full content of the input XML file.

require ‘fileutils’
require ‘find’
require ‘nokogiri’

Find.find(‘C:\Somedir’) do |f|
if f.match(/\data.xml\Z/)
doc = Nokogiri::XML(f)
puts doc
#xslt = Nokogiri::XSLT(File.read(‘C:\Somedir\Sample.xsl’))
#print xslt.transform(doc)
end
end

Couldn’t find a proper debugger for this Ruby version (using Aptana IDE)
reading that there’s no decent working debugger for Windows for Ruby
1.9.3 or something like that. So a bit lost on the ecosystem of these
things…
Yes I know the underground hates Windows.

Thanks to anyone with a good idea :slight_smile:

Cheers,
matan

Matan S. wrote in post #1052466:

Find.find(‘C:\Somedir’) do |f|
if f.match(/\data.xml\Z/)
doc = Nokogiri::XML(f)

You are parsing the file name as XML. You rather want

  doc = File.open(f, 'rb') {|io| Nokogiri::XML(io)}

Cheers

robert

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs