Sha256: 8c556778861cd06d93433c749b1db241feebfeb9d6f43a570b0bc2da740d51b8

Contents?: true

Size: 1.21 KB

Versions: 39

Compression:

Stored size: 1.21 KB

Contents

require 'nokogiri/xslt/stylesheet'

module Nokogiri
  class << self
    ###
    # Create a Nokogiri::XSLT::Stylesheet with +stylesheet+.
    #
    # Example:
    #
    #   xslt = Nokogiri::XSLT(File.read(ARGV[0]))
    #
    def XSLT stylesheet, modules = {}
      XSLT.parse(stylesheet, modules)
    end
  end

  ###
  # See Nokogiri::XSLT::Stylesheet for creating and maniuplating
  # Stylesheet object.
  module XSLT
    class << self
      ###
      # Parse the stylesheet in +string+, register any +modules+
      def parse string, modules = {}
        modules.each do |url, klass|
          XSLT.register url, klass
	end

        Stylesheet.parse_stylesheet_doc(XML.parse(string))
      end

      ###
      # Quote parameters in +params+ for stylesheet safety
      def quote_params params
        parray = (params.instance_of?(Hash) ? params.to_a.flatten : params).dup
        parray.each_with_index do |v,i|
          if i % 2 > 0
            parray[i]=
              if v =~ /'/
                "concat('#{ v.gsub(/'/, %q{', "'", '}) }')"
              else
                "'#{v}'";
              end
          else
            parray[i] = v.to_s
          end
        end
        parray.flatten
      end
    end
  end
end

Version data entries

39 entries across 39 versions & 9 rubygems

Version Path
radiant-1.0.0 ruby-debug/ruby/1.8/gems/nokogiri-1.5.0/lib/nokogiri/xslt.rb
iisconfig-0.0.1.pre2 build/bundler/ruby/1.9.1/gems/nokogiri-1.5.0-x86-mingw32/lib/nokogiri/xslt.rb
iisconfig-0.0.1.pre1 build/bundler/ruby/1.9.1/gems/nokogiri-1.5.0-x86-mingw32/lib/nokogiri/xslt.rb
domo-0.0.5 vendor/bundle/ruby/1.9.1/gems/nokogiri-1.5.0/lib/nokogiri/xslt.rb
domo-0.0.4 vendor/bundle/ruby/1.9.1/gems/nokogiri-1.4.4/lib/nokogiri/xslt.rb
horseman-0.0.4 vendor/ruby/1.9.1/gems/nokogiri-1.5.0/lib/nokogiri/xslt.rb
horseman-0.0.3 vendor/ruby/1.9.1/gems/nokogiri-1.5.0/lib/nokogiri/xslt.rb
horseman-0.0.2 vendor/ruby/1.9.1/gems/nokogiri-1.5.0/lib/nokogiri/xslt.rb
nokogiri-maven-1.5.0-java lib/nokogiri/xslt.rb
nokogiri-maglev--1.5.0.1 lib/nokogiri/xslt.rb
nokogiri-1.5.0-java lib/nokogiri/xslt.rb
nokogiri-1.5.0-x86-mingw32 lib/nokogiri/xslt.rb
nokogiri-1.5.0-x86-mswin32-60 lib/nokogiri/xslt.rb
nokogiri-1.5.0 lib/nokogiri/xslt.rb
nokogiri-1.4.7-java lib/nokogiri/xslt.rb
nokogiri-1.4.7-x86-mingw32 lib/nokogiri/xslt.rb
nokogiri-1.4.7-x86-mswin32-60 lib/nokogiri/xslt.rb
nokogiri-1.4.7 lib/nokogiri/xslt.rb
search_biomodel-1.0.0 search_biomodel/ruby/1.8/gems/nokogiri-1.4.6/lib/nokogiri/xslt.rb
nokogiri-1.4.6 lib/nokogiri/xslt.rb