saxon-xslt 0.0.2-universal-java-1.6 → 0.0.3-universal-java-1.6

Sign up to get free protection for your applications and to get access to all the features.
data/lib/saxon/xslt.rb CHANGED
@@ -21,11 +21,14 @@ module Saxon
21
21
  @xslt = @compiler.compile(StreamSource.new(java.io.File.new(xslt_path)))
22
22
  end
23
23
 
24
- def transform(xml_path)
24
+ def transform(xml_path_or_io)
25
+ unless xml_path_or_io.respond_to?(:read)
26
+ xml_path_or_io = File.open(xml_path_or_io, 'r')
27
+ end
25
28
  serializer = @processor.newSerializer()
26
29
  output = java.io.StringWriter.new()
27
30
  serializer.setOutputWriter(output)
28
- xml = @processor.newDocumentBuilder().build(StreamSource.new(java.io.File.new(xml_path)))
31
+ xml = @processor.newDocumentBuilder().build(StreamSource.new(xml_path_or_io.to_inputstream))
29
32
  transformer = @xslt.load
30
33
  transformer.setInitialContextNode(xml)
31
34
  transformer.setDestination(serializer)
@@ -1,5 +1,5 @@
1
1
  module Saxon
2
2
  class Xslt
3
- VERSION = "0.0.2"
3
+ VERSION = "0.0.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: saxon-xslt
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.2
5
+ version: 0.0.3
6
6
  platform: universal-java-1.6
7
7
  authors:
8
8
  - Matt Patterson