Christian Albrecht: March 2010 Archives

Nokogiri Usage

| | Comments (0) | TrackBacks (0)

Just a quick reminder how easy xml transformation with xslt can be. Originally I used the libxml-ruby bindings but they threw a NoMethodException from deep inside the libxml.

After switching to nokogiri the code looked like this and worked as expected.


  xslt = Nokogiri::XSLT.parse(File.open('some_xslt.xsl'))
  result = xslt.transform(Nokogiri::XML.parse(xmlString))