require 'xml/libxml' require 'xml/libxslt' module Rack class XSLView def initialize(app, options) @my_path_info = String.new @app = app @myhash = {} @options = {:myxsl => nil}.merge(options) if @options[:myxsl] == nil @xslt = ::XML::XSLT.new() @xslt.xsl = File.join(File.dirname(__FILE__), 'output.xhtml10.xsl') else @xslt = @options[:myxsl] end end def call(env) if checknoxsl(env) @app.call(env) else unless @options[:passenv] == nil @options[:passenv].each { |envkey| if (mp = env[envkey]) @myhash[envkey] = "#{mp}" end } @xslt.parameters = @myhash end status, headers, @response = @app.call(env) [status, headers, self] end end #response.each { |part| response_body += part } def each(&block) mycontent = "" @response.each { |part| mycontent += part } if ((mycontent.include? "