Class XML::XSLT
In: lib/xml/xslt.rb
Parent: Object

Methods

External Aliases

mediaType -> media_type

Public Class methods

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

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.

[Validate]