saxon-xslt 0.7.0-java → 0.7.1-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0abe4c1503732325841706ee122ecd45daf22476
4
- data.tar.gz: 04b185f85c2b0281b65ceb1ef0174527fbd47861
3
+ metadata.gz: 5440f81db23a8f872a0a6ffc6bb0b2d6ba4b74cf
4
+ data.tar.gz: d2562c17af1af887f9e4626402a08b1b422cd9ba
5
5
  SHA512:
6
- metadata.gz: b6d04c3fdfe1db41ba12d1e81809483d8eb9c264ce96bc2974d6366ca1ad51d1cf2ed261296fa359932a725e79bdf0941bd81a5b16081c8489fdc02caba6dba5
7
- data.tar.gz: 1b6cc8a925624ac90c450290b1200ea8ddfc84f8be061f0518434d1e9184009d72cf6485ba039f67b1a68529e1ee76152c634bfbc0510a5e02bf20ef463979c0
6
+ metadata.gz: fa3ca1a106024bbcaf239f54b8b9619954b0b50685a9596acd418e8974fc30fc66726a2178fd762405db3fada9db7fa80ea3aa6ae7713247abf8d17e51fd1f5a
7
+ data.tar.gz: df75a39327517d290e0d3f43a605e4f2fd89c13df71da7b501b0a656ae2accb7805d2532ce847a89aa1b86142d708a87a9e343cb71c65e13648f23ce7cac47fd
data/.travis.yml CHANGED
@@ -1,3 +1,4 @@
1
+ sudo: false
1
2
  language: ruby
2
3
  rvm:
3
4
  jruby-19mode
@@ -5,3 +6,4 @@ jdk:
5
6
  - openjdk7
6
7
  - oraclejdk7
7
8
  - openjdk6
9
+ cache: bundler
data/Gemfile CHANGED
@@ -2,3 +2,5 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in saxon-xslt.gemspec
4
4
  gemspec
5
+
6
+ gem 'codeclimate-test-reporter', group: :test, require: nil
data/README.md CHANGED
@@ -2,13 +2,14 @@
2
2
 
3
3
  Wraps the Saxon 9 HE XSLT processor Java API so it's easy to use from your JRuby project, with an API modelled on Nokogiri's.
4
4
 
5
- This is a super-minimal first cut, it doesn't do many, many, things that it should.
6
-
7
- It only runs under JRuby.
5
+ Saxon HE is a Java library, so saxon-xslt only runs under JRuby.
8
6
 
7
+ [![Gem Version](https://badge.fury.io/rb/saxon-xslt.svg)](http://badge.fury.io/rb/saxon-xslt)
9
8
  [![Build Status](https://travis-ci.org/fidothe/saxon-xslt.png)](https://travis-ci.org/fidothe/saxon-xslt)
9
+ [![Code Climate](https://codeclimate.com/github/fidothe/saxon-xslt/badges/gpa.svg)](https://codeclimate.com/github/fidothe/saxon-xslt)
10
+ [![Test Coverage](https://codeclimate.com/github/fidothe/saxon-xslt/badges/coverage.svg)](https://codeclimate.com/github/fidothe/saxon-xslt/coverage)
10
11
 
11
- You can find Saxon HE at http://sourceforge.net/projects/saxon/ and Saxonica at http://www.saxonica.com/
12
+ You can find Saxon HE at http://saxon.sourceforge.net/ and Saxonica at http://www.saxonica.com/
12
13
 
13
14
  Saxon HE is (c) Michael H. Kay and released under the Mozilla MPL 1.0 (http://www.mozilla.org/MPL/1.0/)
14
15
 
@@ -35,22 +36,23 @@ input = Saxon.XML(File.open('/path/to/your.xml'))
35
36
  output = transformer.transform(input)
36
37
  ```
37
38
 
38
- XSL parameters can be passed to #transform as a flat array of name, value pairs, or as a hash, e.g.
39
+ XSL parameters can be passed to `#transform` as a flat array of `name`, `value` pairs, or as a hash. `name` can be either a string or a symbol, e.g.
39
40
 
40
41
  ```ruby
41
42
  output = transformer.transform(input, ["my-param", "'my-value'",
42
- "my-other-param", "/take-from@id"])
43
+ :'my-other-param', "/take-from@id"])
43
44
 
44
45
  # or
45
46
 
46
47
  output = transformer.transform(input, {"my-param" => "'my-value'",
47
- "my-other-param" => "/take-from@id"})
48
+ :'my-other-param' => "/select-from@id",
49
+ my_third_param: "'value-again'"})
48
50
  ```
49
51
 
50
- For those familiar with the Saxon API, names are passed directly to the QName constructor.
52
+ For those familiar with the Saxon API, names are passed directly to the QName constructor.
51
53
 
52
54
  Values are evaluated as XPath expressions in context of the document being transformed; this means
53
- that, to pass a string, you must pass an XPath that resolves to a string, i.e. "'You must wrap strings in quotes'"
55
+ that, to pass a string, you must pass an XPath that resolves to a string, i.e. "'You must wrap strings in quotes'"
54
56
 
55
57
  ## Saxon version
56
58
  `saxon-xslt` 0.7 includes Saxon HE 9.5.1.7
@@ -1,5 +1,5 @@
1
1
  module Saxon
2
2
  module XSLT
3
- VERSION = "0.7.0"
3
+ VERSION = "0.7.1"
4
4
  end
5
5
  end
data/lib/saxon/xslt.rb CHANGED
@@ -91,12 +91,12 @@ module Saxon
91
91
  case params
92
92
  when Hash
93
93
  params.each do |k,v|
94
- transformer.setParameter(S9API::QName.new(k), document.xpath(v))
94
+ transformer.setParameter(S9API::QName.new(k.to_s), document.xpath(v))
95
95
  end
96
96
  when Array
97
97
  params.each_slice(2) do |k,v|
98
98
  raise ArgumentError.new("Odd number of values passed as params: #{params}") if v.nil?
99
- transformer.setParameter(S9API::QName.new(k), document.xpath(v))
99
+ transformer.setParameter(S9API::QName.new(k.to_s), document.xpath(v))
100
100
  end
101
101
  end
102
102
  end
@@ -75,6 +75,14 @@ describe Saxon::XSLT do
75
75
  end
76
76
  end
77
77
 
78
+ context "using hash params with symbol keys" do
79
+ let(:result) { xsl.transform(xml, testparam: "'non-default'") }
80
+
81
+ it "contains the parameter value string" do
82
+ expect(result.to_s.strip).to include("non-default")
83
+ end
84
+ end
85
+
78
86
  context "using array params" do
79
87
  let(:result) { xsl.transform(xml, ["testparam", "'non-default'"]) }
80
88
 
data/spec/spec_helper.rb CHANGED
@@ -1,3 +1,6 @@
1
+ require 'codeclimate-test-reporter'
2
+ CodeClimate::TestReporter.start
3
+
1
4
  require 'vcr'
2
5
 
3
6
  module FixtureHelpers
@@ -10,6 +13,7 @@ VCR.configure do |c|
10
13
  c.cassette_library_dir = 'spec/fixtures/cassettes'
11
14
  c.hook_into :webmock
12
15
  c.configure_rspec_metadata!
16
+ c.ignore_hosts 'codeclimate.com'
13
17
  end
14
18
 
15
19
  RSpec.configure do |c|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: saxon-xslt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.1
5
5
  platform: java
6
6
  authors:
7
7
  - Matt Patterson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-26 00:00:00.000000000 Z
11
+ date: 2015-09-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement