Sha256: a95ecfe3b942678e09612eb1d11650771b8e5531095b87023e7e96f5fe67331b

Contents?: true

Size: 1.33 KB

Versions: 400

Compression:

Stored size: 1.33 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 manipulating
  # 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

        if Nokogiri.jruby?
          Stylesheet.parse_stylesheet_doc(XML.parse(string), string)
        else
          Stylesheet.parse_stylesheet_doc(XML.parse(string))
        end
      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

400 entries across 371 versions & 34 rubygems

Version Path
nokogiri-1.10.4-x64-mingw32 lib/nokogiri/xslt.rb
nokogiri-1.10.4-java lib/nokogiri/xslt.rb
zuora_connect_ui-0.7.1 vendor/ruby/2.6.0/gems/nokogiri-1.10.3/lib/nokogiri/xslt.rb
zuora_connect_ui-0.7.0 vendor/ruby/2.6.0/gems/nokogiri-1.10.3/lib/nokogiri/xslt.rb
nokogiri-1.10.3 lib/nokogiri/xslt.rb
nokogiri-1.10.3-x86-mingw32 lib/nokogiri/xslt.rb
nokogiri-1.10.3-x64-mingw32 lib/nokogiri/xslt.rb
nokogiri-1.10.3-java lib/nokogiri/xslt.rb
tdiary-5.0.13 vendor/bundle/gems/nokogiri-1.10.2/lib/nokogiri/xslt.rb
tdiary-5.0.12.1 vendor/bundle/gems/nokogiri-1.10.2/lib/nokogiri/xslt.rb
nokogiri-1.10.2 lib/nokogiri/xslt.rb
nokogiri-1.10.2-x86-mingw32 lib/nokogiri/xslt.rb
nokogiri-1.10.2-x64-mingw32 lib/nokogiri/xslt.rb
nokogiri-1.10.2-java lib/nokogiri/xslt.rb
nokogiri-1.10.1-x86-mingw32 lib/nokogiri/xslt.rb
nokogiri-1.10.1-x64-mingw32 lib/nokogiri/xslt.rb
nokogiri-1.10.1-java lib/nokogiri/xslt.rb
nokogiri-1.10.1 lib/nokogiri/xslt.rb
nokogiri-1.10.0 lib/nokogiri/xslt.rb
nokogiri-1.10.0-x86-mingw32 lib/nokogiri/xslt.rb