Sha256: 68f85006a5927da1edd838d74173186f76557f14c8bc0709a68a7747743bf36e

Contents?: true

Size: 1.01 KB

Versions: 2

Compression:

Stored size: 1.01 KB

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
      class << self
        # create a xslt stylesheet from a string
        def 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 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 io(io_object)
          doc = LibXML::XML::Parser.io(io_object, :options => PARSE_OPTIONS).parse
          return new(doc)
        end
      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.1.1-x64-mingw32 lib/libxslt/stylesheet.rb
libxslt-ruby-1.1.1 lib/libxslt/stylesheet.rb