Sha256: 2d6bc7d19c87132d0b9139ba80855a72f83ab7912d3912e7bc7471a1e09d5a97

Contents?: true

Size: 1.08 KB

Versions: 52

Compression:

Stored size: 1.08 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
      XSLT.parse(stylesheet)
    end
  end

  ###
  # See Nokogiri::XSLT::Stylesheet for creating and maniuplating
  # Stylesheet object.
  module XSLT
    class << self
      ###
      # Parse the stylesheet in +string+
      def parse string
        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

52 entries across 52 versions & 8 rubygems

Version Path
revo-nokogiri-1.4.1-java lib/nokogiri/xslt.rb
revo-nokogiri-1.4.0.3-java lib/nokogiri/xslt.rb
revo-nokogiri-1.4.0-java lib/nokogiri/xslt.rb
revo-nokogiri-1.4.0.20100202165440-java lib/nokogiri/xslt.rb
akamai_bookmarklet-0.1.1 vendor/gems/ruby/1.8/gems/nokogiri-1.3.3/lib/nokogiri/xslt.rb
akamai_bookmarklet-0.1.0 vendor/gems/ruby/1.8/gems/nokogiri-1.3.3/lib/nokogiri/xslt.rb
nokogiri-1.4.1-x86-mswin32 lib/nokogiri/xslt.rb
nokogiri-1.4.1-x86-mingw32 lib/nokogiri/xslt.rb
nokogiri-1.4.1-java lib/nokogiri/xslt.rb
nokogiri-1.4.1 lib/nokogiri/xslt.rb
superfeedr-nokogiri-1.4.0.20091116183308 lib/nokogiri/xslt.rb
caring-nokogiri-1.4.1.pre1 lib/nokogiri/xslt.rb
nokogiri-1.4.0-java lib/nokogiri/xslt.rb
nokogiri-1.4.0-x86-mswin32 lib/nokogiri/xslt.rb
nokogiri-1.4.0-x86-mingw32 lib/nokogiri/xslt.rb
nokogiri-1.4.0 lib/nokogiri/xslt.rb
nokogiri-1.3.3-x86-mswin32 lib/nokogiri/xslt.rb
nokogiri-1.3.3-x86-mingw32 lib/nokogiri/xslt.rb
nokogiri-1.3.3-java lib/nokogiri/xslt.rb
nokogiri-1.3.2-x86-mswin32 lib/nokogiri/xslt.rb