Namespace

Class Index [+]

Quicksearch

Nokogiri::XSLT

 

See Nokogiri::XSLT::Stylesheet for creating and manipulating Stylesheet object.

Public Class Methods

parse(string, modules = {}) click to toggle source
 

Parse the stylesheet in string, register any modules

    # File lib/nokogiri/xslt.rb, line 24
24:       def parse string, modules = {}
25:         modules.each do |url, klass|
26:           XSLT.register url, klass
27:         end
28: 
29:         if Nokogiri.jruby?
30:           Stylesheet.parse_stylesheet_doc(XML.parse(string), string)
31:         else
32:           Stylesheet.parse_stylesheet_doc(XML.parse(string))
33:         end
34:       end
quote_params(params) click to toggle source
 

Quote parameters in params for stylesheet safety

    # File lib/nokogiri/xslt.rb, line 38
38:       def quote_params params
39:         parray = (params.instance_of?(Hash) ? params.to_a.flatten : params).dup
40:         parray.each_with_index do |v,i|
41:           if i % 2 > 0
42:             parray[i]=
43:               if v =~ /'/
44:                 "concat('#{ v.gsub(/'/, %q{', "'", '}) }')"
45:               else
46:                 "'#{v}'";
47:               end
48:           else
49:             parray[i] = v.to_s
50:           end
51:         end
52:         parray.flatten
53:       end
register(uri, custom_handler_class) click to toggle source

Register a class that implements custom XLST transformation functions.

static VALUE registr(VALUE self, VALUE uri, VALUE obj)
{
    VALUE modules = rb_iv_get(self, "@modules");
    if(NIL_P(modules)) rb_raise(rb_eRuntimeError, "wtf! @modules isn't set");

    rb_hash_aset(modules, uri, obj);
    xsltRegisterExtModule((unsigned char *)StringValuePtr(uri), initFunc, shutdownFunc);
    return self;
}

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.