Class: Mtk_xslt::Xalan

Inherits:
Object show all
Defined in:
lib/ontomde-core/xslt.rb

Direct Known Subclasses

XsltProcessor

Constant Summary collapse

TRANSFORMER_FACTORY_IMPL =
"org.apache.xalan.processor.TransformerFactoryImpl"

Instance Method Summary collapse

Constructor Details

#initializeXalan

Returns a new instance of Xalan.

Raises:

  • (Exception)


60
61
62
63
64
# File 'lib/ontomde-core/xslt.rb', line 60

def initialize
  System.setProperty("javax.xml.transform.TransformerFactory", TRANSFORMER_FACTORY_IMPL)
  @tf = TransformerFactory.newInstance
  raise Exception.new("\n*** *******\n*** ERROR loading saxon into jruby.\n*** This error may be caused by missing xalan jars in jruby lib directory\n*** *******") if @tf.nil?
end

Instance Method Details

#nameObject



56
57
58
# File 'lib/ontomde-core/xslt.rb', line 56

def name
		return "jruby/xalanl"
end

#transform(xslt, infile, outfile) ⇒ Object



52
53
54
55
# File 'lib/ontomde-core/xslt.rb', line 52

def transform(xslt,infile,outfile)
  transformer = @tf.newTransformer(StreamSource.new(xslt))
  transformer.transform(StreamSource.new(infile), StreamResult.new(outfile))
end