rexslt 0.4.2 → 0.4.3
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
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/rexslt.rb +27 -12
- metadata +43 -29
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a3bf1a0e1cf9b43802dfb28fffd0c3aa04a3e08
|
4
|
+
data.tar.gz: 0f023aa72ce7df0b1e4d01eb74bedc6119c5df39
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 537c86472bc5971a9e99b17f6416428240b2deef586d4c6aea9e9d94f756516ec7a3ab5a7470640d10c72bacbde888db2023884102a40c47797c8a49430cece9
|
7
|
+
data.tar.gz: b90150549fdc860d9aa6c27f106348966317b599d7e5d75c4e281fcd73d9984d189374a7469f7a667f7fab2427f26ad0d5e8c042d9341d74eead7dcf33bd5e0a
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/rexslt.rb
CHANGED
@@ -192,8 +192,9 @@ class Rexslt
|
|
192
192
|
|
193
193
|
new_element = Rexle::Element.new(name) # .add_text(x.value.strip)
|
194
194
|
|
195
|
-
doc_element.
|
195
|
+
doc_element.text = element.text if element.text
|
196
196
|
read_node(x, element, new_element, indent, i)
|
197
|
+
doc_element.add new_element
|
197
198
|
indent_after(element, x, doc_element, indent, i) if @indent == true
|
198
199
|
end
|
199
200
|
|
@@ -238,6 +239,7 @@ class Rexslt
|
|
238
239
|
def xsl_if(element, x, doc_element, indent, i=0)
|
239
240
|
|
240
241
|
condition = x.attributes[:test].gsub('position()',i.to_s).gsub('<','<').gsub('>','>')
|
242
|
+
|
241
243
|
result = element.element condition
|
242
244
|
|
243
245
|
if result then
|
@@ -285,6 +287,7 @@ class Rexslt
|
|
285
287
|
procs = {"Rexle::Element" => :read_raw_element, "String" => :read_raw_text}
|
286
288
|
|
287
289
|
template_node.children.each_with_index do |x,j|
|
290
|
+
|
288
291
|
method(procs[x.class.to_s]).call(element, x, doc_element, indent, i)
|
289
292
|
|
290
293
|
end
|
@@ -298,12 +301,15 @@ class Rexslt
|
|
298
301
|
#val = @indent == true ? padding(doc_element, raw_indent, x) : ''
|
299
302
|
if x.to_s.strip.length > 0 then
|
300
303
|
val = x.to_s #
|
301
|
-
doc_element.add_element val
|
304
|
+
#jr040316 doc_element.add_element val
|
302
305
|
end
|
306
|
+
|
307
|
+
doc_element.add_text x if x.is_a? String
|
308
|
+
|
303
309
|
end
|
304
310
|
|
305
311
|
def read_raw_element(element, x, doc_element, indent, j)
|
306
|
-
|
312
|
+
|
307
313
|
method_name = x.name.gsub(/[:-]/,'_').to_sym
|
308
314
|
|
309
315
|
if @xsl_methods.include? method_name then
|
@@ -311,7 +317,7 @@ class Rexslt
|
|
311
317
|
if method_name == :'xsl_apply_templates' then
|
312
318
|
#doc_element = doc_element.elements.last
|
313
319
|
end
|
314
|
-
|
320
|
+
|
315
321
|
method(method_name).call(element, x, doc_element, indent, i=0)
|
316
322
|
|
317
323
|
else
|
@@ -323,7 +329,9 @@ class Rexslt
|
|
323
329
|
if x.children.length > 0 then
|
324
330
|
|
325
331
|
new_element = x.clone
|
326
|
-
|
332
|
+
|
333
|
+
#jr030316 new_element.text = ''
|
334
|
+
new_element.text = x.text
|
327
335
|
|
328
336
|
new_element.attributes.each do |k,v|
|
329
337
|
|
@@ -337,8 +345,9 @@ class Rexslt
|
|
337
345
|
end
|
338
346
|
|
339
347
|
indent_before(element, x, doc_element, new_indent, j) if @indent == true
|
340
|
-
|
348
|
+
|
341
349
|
read_node(x, element, new_element, new_indent, i)
|
350
|
+
doc_element.add new_element
|
342
351
|
|
343
352
|
if @indent == true then
|
344
353
|
if doc_element.children.last.children.any? \
|
@@ -358,7 +367,7 @@ class Rexslt
|
|
358
367
|
|
359
368
|
end
|
360
369
|
end
|
361
|
-
|
370
|
+
|
362
371
|
end
|
363
372
|
|
364
373
|
def xsl_text(element, x, doc_element, indent, i)
|
@@ -368,7 +377,7 @@ class Rexslt
|
|
368
377
|
end
|
369
378
|
|
370
379
|
def xsl_value_of(element, x, doc_element, indent, i)
|
371
|
-
|
380
|
+
|
372
381
|
field = x.attributes[:select]
|
373
382
|
|
374
383
|
o = case field
|
@@ -381,14 +390,19 @@ class Rexslt
|
|
381
390
|
ee
|
382
391
|
end
|
383
392
|
|
384
|
-
doc_element.add_element o.to_s #unless o.to_s.empty?
|
393
|
+
#jr030316 doc_element.add_element o.to_s #unless o.to_s.empty?
|
394
|
+
|
395
|
+
doc_element.add_text o
|
396
|
+
|
397
|
+
doc_element
|
385
398
|
end
|
386
399
|
|
387
400
|
|
388
|
-
def xslt_transform(
|
401
|
+
def xslt_transform(raw_xsl, xml, custom_params={})
|
389
402
|
|
390
403
|
doc_xml = Rexle.new xml
|
391
|
-
@doc_xsl = Rexle.new
|
404
|
+
@doc_xsl = Rexle.new raw_xsl.gsub(/ +/,' ').gsub(/\n/,'')\
|
405
|
+
.gsub(/> /,'>').gsub(/ </,'<')
|
392
406
|
|
393
407
|
@doc = Rexle.new '<root></root>'
|
394
408
|
indent = 0
|
@@ -425,7 +439,8 @@ class Rexslt
|
|
425
439
|
end
|
426
440
|
|
427
441
|
# using the 1st template
|
428
|
-
xpath = String.new @templates.to_a[0][0]
|
442
|
+
xpath = String.new @templates.to_a[0][0]
|
443
|
+
|
429
444
|
read_node(@templates.to_a[0][-1], doc_xml.element(xpath), @doc.root, indent)
|
430
445
|
|
431
446
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rexslt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -10,55 +10,69 @@ bindir: bin
|
|
10
10
|
cert_chain:
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
|
-
|
13
|
+
MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
|
14
14
|
YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
|
15
|
-
|
15
|
+
8ixkARkWAmV1MB4XDTE2MDMwNDIzNTg1NloXDTE3MDMwNDIzNTg1NlowSDESMBAG
|
16
16
|
A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
|
17
17
|
EjAQBgoJkiaJk/IsZAEZFgJldTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
18
|
+
ggEBAKzE015vYQSwDJ3b9+oMbtv9xKd3bx9aTF0MuF00hKmbPjFHd3L6dyJoEWCy
|
19
|
+
ZYxqiJZykN/TH8RD6wCvqPqtRwCM4j4zubSLfx9pLrWfA9KyHZ76sHNFvMwKJowV
|
20
|
+
/LvaQVWFsyvisyUGE5700jKE0pzt42g2MTIBsci6Lj6RTWzP5o1GgKVHEGW8JDv/
|
21
|
+
AEWspA+gCGoScP4lBKrwnfhjx8e0giWenEMxZFQLllLJcd95bxBsPudVXA9fSsZJ
|
22
|
+
LTSRPrEzX2w/T+BxTMwA3avOWPij/EqmfalHjBvruV9VHX7SIQb3wp8njvgFwI80
|
23
|
+
ctKDJ9kHhU0ImdBFsrEV91m3occCAwEAAaOBijCBhzAJBgNVHRMEAjAAMAsGA1Ud
|
24
|
+
DwQEAwIEsDAdBgNVHQ4EFgQUDSdtw1Awl7Da9uo7Dk/jGadtV8swJgYDVR0RBB8w
|
25
|
+
HYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1h
|
26
|
+
c3RlckBqYW1lc3JvYmVydHNvbi5ldTANBgkqhkiG9w0BAQUFAAOCAQEAPMbAn90u
|
27
|
+
s7nXLA0sr2fcImZAoeklGL7xVxAjKPgy9T56LFU6KVe0p9u4uxXzs3Gi4HKIF/5P
|
28
|
+
P5uGfjvfnzhl0vNKbFMyrvAcgAYRR+4/T2KJHetMUBEOll3hvOgCEL96P2A3rvBs
|
29
|
+
Ey6GvidwOJWsH1l2PuYXh/XHX9OAUoYuzZf0oK0LSMpdqwmdyGBaIaGS/JIfusfZ
|
30
|
+
qti4dC2jX2jBO+yVrjhxjUa2mhJ4FMvFakkFu6ygoV2E2xff/njkAaoQHh6LW1R4
|
31
|
+
38j2+6ULVWalsVein3whb7qB6IOvxoSqjz6n7jAKFGHovoXPUqpv5y5Yor23rTrn
|
32
|
+
0YwisIc3UkL30g==
|
31
33
|
-----END CERTIFICATE-----
|
32
|
-
date:
|
34
|
+
date: 2016-03-04 00:00:00.000000000 Z
|
33
35
|
dependencies:
|
34
36
|
- !ruby/object:Gem::Dependency
|
35
37
|
name: rxfhelper
|
36
38
|
requirement: !ruby/object:Gem::Requirement
|
37
39
|
requirements:
|
38
|
-
- -
|
40
|
+
- - "~>"
|
39
41
|
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
42
|
+
version: '0.1'
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 0.1.12
|
41
46
|
type: :runtime
|
42
47
|
prerelease: false
|
43
48
|
version_requirements: !ruby/object:Gem::Requirement
|
44
49
|
requirements:
|
45
|
-
- -
|
50
|
+
- - "~>"
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '0.1'
|
53
|
+
- - ">="
|
46
54
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
55
|
+
version: 0.1.12
|
48
56
|
- !ruby/object:Gem::Dependency
|
49
57
|
name: rexle
|
50
58
|
requirement: !ruby/object:Gem::Requirement
|
51
59
|
requirements:
|
52
|
-
- -
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '1.0'
|
63
|
+
- - ">="
|
53
64
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
65
|
+
version: 1.0.11
|
55
66
|
type: :runtime
|
56
67
|
prerelease: false
|
57
68
|
version_requirements: !ruby/object:Gem::Requirement
|
58
69
|
requirements:
|
59
|
-
- -
|
70
|
+
- - "~>"
|
60
71
|
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
72
|
+
version: '1.0'
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 1.0.11
|
62
76
|
description:
|
63
77
|
email: james@r0bertson.co.uk
|
64
78
|
executables: []
|
@@ -76,17 +90,17 @@ require_paths:
|
|
76
90
|
- lib
|
77
91
|
required_ruby_version: !ruby/object:Gem::Requirement
|
78
92
|
requirements:
|
79
|
-
- -
|
93
|
+
- - ">="
|
80
94
|
- !ruby/object:Gem::Version
|
81
|
-
version:
|
95
|
+
version: 2.1.2
|
82
96
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
83
97
|
requirements:
|
84
|
-
- -
|
98
|
+
- - ">="
|
85
99
|
- !ruby/object:Gem::Version
|
86
100
|
version: '0'
|
87
101
|
requirements: []
|
88
102
|
rubyforge_project:
|
89
|
-
rubygems_version: 2.
|
103
|
+
rubygems_version: 2.4.8
|
90
104
|
signing_key:
|
91
105
|
specification_version: 4
|
92
106
|
summary: Rexslt is an XSLT processor written purely in Ruby
|
metadata.gz.sig
CHANGED
Binary file
|