In Files

Parent

Class/Module Index [+]

Quicksearch

XML::XSLT

Public Class Methods

registerErrorHandler(&block) click to toggle source

registers a block to be called when libxml2 or libxslt encounter an error eg:

XML::XSLT.registerErrorHandler do |error_str|
  $stderr.puts error_str
end
# File lib/xml/xslt.rb, line 67
def self.registerErrorHandler(&block)
  @@error_handler = block
end
Also aliased as: register_error_handler
registerExtFunc(namespace, name, &block) click to toggle source

sets up a block for callback when the XPath function namespace:name( … ) is encountered in a stylesheet.

XML::XSLT.registerExtFunc(namespace_uri, name) do |*args|
  puts args.inspect
end

XPath arguments are converted to Ruby objects accordingly:

number (eg. 1)

Float

boolean (eg. false())

TrueClass/FalseClass

nodeset (eg. /entry/*)

Array of REXML::Elements

variable (eg. $var)

UNIMPLEMENTED

It works the same in the other direction, eg. if the block returns an array of REXML::Elements the value of the function will be a nodeset.

Note: currently, passing a nodeset to Ruby or REXML::Elements to libxslt serializes the nodes and then parses them. Doing this with large sets is a bad idea. In the future they’ll be passed back and forth using Ruby’s libxml2 bindings.

# File lib/xml/xslt.rb, line 47
def self.registerExtFunc(namespace, name, &block)
  @@extFunctions[namespace] ||= {}
  @@extFunctions[namespace][name] = block
  XML::XSLT.registerFunction(namespace, name)
end
Also aliased as: register_ext_func
register_error_handler(&block) click to toggle source
register_ext_func(namespace, name, &block) click to toggle source
Alias for: registerExtFunc

[Validate]

Generated with the Darkfish Rdoc Generator 2.