Module: Nokogiri::XSLT
- Defined in:
- lib/nokogiri/xslt.rb,
lib/nokogiri/xslt/stylesheet.rb,
lib/nokogiri/ffi/xslt/stylesheet.rb,
ext/nokogiri/nokogiri.c,
ext/nokogiri/xslt_stylesheet.c
Overview
See Nokogiri::XSLT::Stylesheet for creating and maniuplating Stylesheet object.
Defined Under Namespace
Classes: Stylesheet
Class Method Summary collapse
-
.parse(string) ⇒ Object
Parse the stylesheet in
string
. -
.quote_params(params) ⇒ Object
Quote parameters in
params
for stylesheet safety.
Class Method Details
.parse(string) ⇒ Object
Parse the stylesheet in string
24 25 26 |
# File 'lib/nokogiri/xslt.rb', line 24 def parse string Stylesheet.parse_stylesheet_doc(XML.parse(string)) end |
.quote_params(params) ⇒ Object
Quote parameters in params
for stylesheet safety
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/nokogiri/xslt.rb', line 30 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 |