Introducing the rexslt gem

The rexslt gem is an experimental pure ruby implementation of an XSLT processor which uses Rexle.

require 'rexslt'

xsl =<<XSL
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

  <xsl:template match="root">
    <xsl:apply-templates select="abc"/>
  </xsl:template>

  <xsl:template match="abc">
    <xsl:value-of select="fun"/>
  </xsl:template>

</xsl:stylesheet>
XSL

xml = "<root><abc><fun>123</fun>465<fun></fun></abc><abc><fun>111</fun></abc></root>"
puts Rexslt.new(xsl, xml).to_s

#=> 123111

Tags:
Source:
1325hrs.txt
Published:
21-11-2011 13:25