saxon-xslt 0.7.0-java → 0.7.1-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +2 -0
- data/Gemfile +2 -0
- data/README.md +11 -9
- data/lib/saxon/xslt/version.rb +1 -1
- data/lib/saxon/xslt.rb +2 -2
- data/spec/saxon/xslt_spec.rb +8 -0
- data/spec/spec_helper.rb +4 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5440f81db23a8f872a0a6ffc6bb0b2d6ba4b74cf
|
4
|
+
data.tar.gz: d2562c17af1af887f9e4626402a08b1b422cd9ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa3ca1a106024bbcaf239f54b8b9619954b0b50685a9596acd418e8974fc30fc66726a2178fd762405db3fada9db7fa80ea3aa6ae7713247abf8d17e51fd1f5a
|
7
|
+
data.tar.gz: df75a39327517d290e0d3f43a605e4f2fd89c13df71da7b501b0a656ae2accb7805d2532ce847a89aa1b86142d708a87a9e343cb71c65e13648f23ce7cac47fd
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
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
|
-
|
6
|
-
|
7
|
-
It only runs under JRuby.
|
5
|
+
Saxon HE is a Java library, so saxon-xslt only runs under JRuby.
|
8
6
|
|
7
|
+
[](http://badge.fury.io/rb/saxon-xslt)
|
9
8
|
[](https://travis-ci.org/fidothe/saxon-xslt)
|
9
|
+
[](https://codeclimate.com/github/fidothe/saxon-xslt)
|
10
|
+
[](https://codeclimate.com/github/fidothe/saxon-xslt/coverage)
|
10
11
|
|
11
|
-
You can find Saxon HE at http://sourceforge.net/
|
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
|
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
|
-
|
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
|
-
|
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
|
data/lib/saxon/xslt/version.rb
CHANGED
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
|
data/spec/saxon/xslt_spec.rb
CHANGED
@@ -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.
|
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-
|
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
|