Sha256: a166434023357bbfab8136d2c2b8f7377acdf634538189f21af84f952a774f63

Contents?: true

Size: 1023 Bytes

Versions: 2

Compression:

Stored size: 1023 Bytes

Contents

module LibXSLT
  module XSLT
    class Stylesheet
      # options to be used for parsing stylesheets
      PARSE_OPTIONS = LibXML::XML::Parser::Options::NOCDATA | LibXML::XML::Parser::Options::NOENT

      # create a xslt stylesheet from a string
      def self.string(xml)
        doc = LibXML::XML::Parser.string(xml, :options => PARSE_OPTIONS).parse
        return new(doc)
      end

      # create a xslt stylesheet from a file specified by its filename
      def self.file(filename)
        doc = LibXML::XML::Parser.file(filename, :options => PARSE_OPTIONS).parse
        return new(doc)
      end

      # create a xslt stylesheet from an io object
      def self.io(io_object)
        doc = LibXML::XML::Parser.io(io_object, :options => PARSE_OPTIONS).parse
        return new(doc)
      end

      # transform a xml to a string
      def transform(doc)
        return output(apply(doc))
      end
      # transform a xml to a file (specified by an output stream)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
libxslt-ruby-1.2.0-x64-mingw32 lib/libxslt/stylesheet.rb
libxslt-ruby-1.2.0 lib/libxslt/stylesheet.rb