Class: Mtk_xslt::Saxon
Constant Summary collapse
- TRANSFORMER_FACTORY_IMPL =
"net.sf.saxon.TransformerFactoryImpl"
Instance Method Summary collapse
-
#initialize ⇒ Saxon
constructor
A new instance of Saxon.
- #name ⇒ Object
- #transform(xslt, infile, outfile) ⇒ Object
Constructor Details
#initialize ⇒ Saxon
Returns a new instance of Saxon.
45 46 47 48 49 |
# File 'lib/ontomde-core/xslt.rb', line 45 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 Saxon jars in jruby lib directory\n*** *******") if @tf.nil? end |
Instance Method Details
#name ⇒ Object
41 42 43 |
# File 'lib/ontomde-core/xslt.rb', line 41 def name return "jruby/saxon" end |
#transform(xslt, infile, outfile) ⇒ Object
37 38 39 40 |
# File 'lib/ontomde-core/xslt.rb', line 37 def transform(xslt,infile,outfile) transformer = @tf.newTransformer(StreamSource.new(xslt)) transformer.transform(StreamSource.new(infile), StreamResult.new(outfile)) end |