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