rexslt 0.6.7 → 0.6.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (6) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +4 -1
  4. data/lib/rexslt.rb +30 -14
  5. metadata +27 -27
  6. metadata.gz.sig +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6b9f9d1e95abd8795d63744c0613a83fefb69538
4
- data.tar.gz: b6894d0c8ba12bc0dd496317a0dba27867068d46
3
+ metadata.gz: f3b4e51d09e5a32477d0cbd84750233fb11efd6c
4
+ data.tar.gz: 15664915741e3124b9350d4ed21532d83939b0f1
5
5
  SHA512:
6
- metadata.gz: f500a58273e176530b31f57eafc970e35f0a804ce150ebd50ce1165b39af263b57fabb1c3f996a902f2f8df94bbf4d54ea1cd23139f28510537d249f5433eee2
7
- data.tar.gz: a5eceb8b10c79f6607fe721869e6221b35e7bf75ea5b24fa94fc8c72441a93398faf9f9ccb5dbfb2b1b0f8b29e679654ce61d3c411215c7efd7552c3a22265b4
6
+ metadata.gz: 0e0911d84d2694bbc7f3d6552a8cc8e9ac4620eefd6325166ada84c7aa16a2ecf52a466e0b23359ddc9230b666fb70c403f32f55362f310fa84e63d68431eff0
7
+ data.tar.gz: '0738ec497ce3ac97486c89affe40716a10b790cdfa3265aee6614dc0d8e5d3c4d9e4fea8ba86cb7f7ab23fd94956364d686d42a04aa118cec0674a9ebab7082e'
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
@@ -1 +1,4 @@
1
- a$�i�*�ԭ�r&�nJw����C��)7" ��e�\*��ɴ�M13ZuNR��c��lٛ�
1
+ Ÿ����(
2
+ � �O�p�(��{9x(M�'C �@���ўE�L��� �xW�k J�yh/�O%d)�ʷM�Hg�&^ ��N3�N�+�;s���
3
+ N�5���Jd
4
+  n�n��]�n�-~�3/�)���)�/ն��ANU�Suj��m�}���c ����~��u#3'�W3|����UY��۠?��� �-"qgn€1{'[�L@I/6�I�*4�/�@�dNS�Ԁ�.�'6|_=3
data/lib/rexslt.rb CHANGED
@@ -8,6 +8,7 @@ require 'rxfhelper'
8
8
 
9
9
  # modifications:
10
10
 
11
+ # 15-Sep-2017: feature: Implemented xsl_call_template
11
12
  # 21-May-2016: bug fix: An update to the Rexle gem regarding the new
12
13
  # Rexle::Element::Attribute datatype caused the sort_by code
13
14
  # to break. This has now been rectified.
@@ -59,12 +60,16 @@ class Rexslt
59
60
 
60
61
  ## debugging variables
61
62
 
63
+ @log = Logger.new 'rxsl.log','daily'
62
64
  @rn = 0
63
65
  @rre = 0
64
66
 
65
67
  super()
68
+ @log.debug 'before options'
66
69
  @options = {}
67
70
  custom_params = params.inject({}){|r,x| r.merge(Hash[x[0].to_s,x[1]])}
71
+ @log.debug 'before xsl_transform'
72
+
68
73
  xslt_transform(*[xsl, xml].map{|x| RXFHelper.read(x).first}, custom_params)
69
74
  end
70
75
 
@@ -117,7 +122,7 @@ class Rexslt
117
122
  end
118
123
 
119
124
  raw_template = @templates.to_a.find do |raw_item, template|
120
-
125
+ next unless raw_item
121
126
  item = raw_item.split('/')
122
127
 
123
128
  if match? keypath, item then
@@ -197,16 +202,26 @@ class Rexslt
197
202
 
198
203
  doc_element.add_attribute(name, value)
199
204
  end
205
+
206
+ def xsl_call_template(element, x, doc_element, indent, i)
207
+
208
+ name = x.attributes[:name]
209
+ template = @doc_xsl.root.element("xsl:template[@name='#{name}']")
210
+
211
+ read_node template, element, doc_element, indent, i
212
+ end
200
213
 
201
214
  def xsl_choose(element, x, doc_element, indent, i)
202
215
 
216
+
203
217
  r = x.xpath("xsl:when").map do |xsl_node|
204
218
 
205
219
  condition = xsl_node.attributes[:test]
220
+
206
221
  node = element.element condition
207
-
222
+
208
223
  if node
209
- read_node(xsl_node, element, doc_element, indent, i)
224
+ read_raw_element(element, xsl_node.elements.first, doc_element, indent, i)
210
225
  true
211
226
  else
212
227
  false
@@ -234,7 +249,7 @@ class Rexslt
234
249
  end
235
250
 
236
251
  def xsl_element(element, x, doc_element, indent, i)
237
-
252
+
238
253
  indent_before(element, x, doc_element, indent + 1, i) if @indent == true
239
254
 
240
255
  name = x.attributes[:name]
@@ -355,7 +370,7 @@ class Rexslt
355
370
  # doc_element: target document element
356
371
  #
357
372
  def read_node(template_node, element, doc_element, indent, i=0)
358
-
373
+
359
374
  template_node.children.each_with_index do |x,j|
360
375
 
361
376
  name = if x.kind_of? Rexle::Element then :read_raw_element
@@ -392,9 +407,9 @@ class Rexslt
392
407
  def read_raw_element(element, x, doc_element, indent, j)
393
408
 
394
409
  method_name = x.name.gsub(/[:-]/,'_').to_sym
395
-
410
+
396
411
  if @xsl_methods.include? method_name then
397
-
412
+
398
413
  if method_name == :'xsl_apply_templates' then
399
414
  #doc_element = doc_element.elements.last
400
415
  end
@@ -502,19 +517,22 @@ class Rexslt
502
517
 
503
518
  def xslt_transform(raw_xsl, xml, custom_params={})
504
519
 
520
+ @log.debug 'inside xslt_transform'
521
+
505
522
  doc_xml = xml.is_a?(Rexle) ? xml : Rexle.new(xml)
506
-
523
+
507
524
  @doc_xsl = raw_xsl.is_a?(Rexle) ? raw_xsl : Rexle.new(raw_xsl)
508
-
525
+ @log.debug 'after @doc_xsl'
509
526
 
510
527
  #jr2040516 filter_out_spaces @doc_xsl.root
511
528
 
512
529
  @doc = Rexle.new '<root></root>'
530
+
513
531
  indent = 0
514
532
 
515
533
  previous_indent = 0
516
534
  @xsl_methods = %i(apply_templates value_of element if choose when copy_of
517
- attribute for_each text output).map do |x|
535
+ attribute for_each text output call_template).map do |x|
518
536
  ('xsl_' + x.to_s).to_sym
519
537
  end
520
538
 
@@ -530,6 +548,7 @@ class Rexslt
530
548
  end
531
549
 
532
550
  h = @doc_xsl.root.element("xsl:output/attribute::*")
551
+ @log.debug 'after h'
533
552
 
534
553
  if h and ((h[:method] and h[:method].downcase == 'html') \
535
554
  or h[:'omit-xml-declaration'] == 'yes') then
@@ -586,10 +605,7 @@ class Rexslt
586
605
 
587
606
  end
588
607
  end
589
-
590
-
591
-
592
-
608
+
593
609
  out
594
610
 
595
611
  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.6.7
4
+ version: 0.6.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -12,26 +12,26 @@ cert_chain:
12
12
  -----BEGIN CERTIFICATE-----
13
13
  MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
14
14
  YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
15
- 8ixkARkWAmV1MB4XDTE2MDMwNDIzNTg1NloXDTE3MDMwNDIzNTg1NlowSDESMBAG
15
+ 8ixkARkWAmV1MB4XDTE3MDkxNTIwMjQwM1oXDTE4MDkxNTIwMjQwM1owSDESMBAG
16
16
  A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
17
17
  EjAQBgoJkiaJk/IsZAEZFgJldTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
18
- ggEBAKzE015vYQSwDJ3b9+oMbtv9xKd3bx9aTF0MuF00hKmbPjFHd3L6dyJoEWCy
19
- ZYxqiJZykN/TH8RD6wCvqPqtRwCM4j4zubSLfx9pLrWfA9KyHZ76sHNFvMwKJowV
20
- /LvaQVWFsyvisyUGE5700jKE0pzt42g2MTIBsci6Lj6RTWzP5o1GgKVHEGW8JDv/
21
- AEWspA+gCGoScP4lBKrwnfhjx8e0giWenEMxZFQLllLJcd95bxBsPudVXA9fSsZJ
22
- LTSRPrEzX2w/T+BxTMwA3avOWPij/EqmfalHjBvruV9VHX7SIQb3wp8njvgFwI80
23
- ctKDJ9kHhU0ImdBFsrEV91m3occCAwEAAaOBijCBhzAJBgNVHRME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==
26
+ c3RlckBqYW1lc3JvYmVydHNvbi5ldTANBgkqhkiG9w0BAQUFAAOCAQEAhp3O3yYu
27
+ +96s1H5S297WguKDGrNKJoa44o+6IU4JefUxkmfidtaSwcPnnCaAsoLXzBLpnwlY
28
+ m6LH1jPWHqnJlUHjtkjr/wp620cWGKcwFw8VlfqdNALV9tALCHje5J+NITR2U9P6
29
+ Q6tcZFPZmUCr8SvlQlqGJY1BY/e9iajntzL0j6QvBZLzaQbej1DY5Dbv3e2ipOZq
30
+ gQdsDg5v3CppCdi6o+CG+Q+K2P6w4EBdWKHn9FhYUMp4oDiBznW7D+dpEraoyER7
31
+ f4Fi5ORmK9ccbijkIGmH2JdFYi07Fax/6a8TgcpbSrICHncFAvvPo8hxuUR+aHvg
32
+ wux0hu0gdmk8nA==
33
33
  -----END CERTIFICATE-----
34
- date: 2016-05-21 00:00:00.000000000 Z
34
+ date: 2017-09-15 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rxfhelper
@@ -39,42 +39,42 @@ dependencies:
39
39
  requirements:
40
40
  - - "~>"
41
41
  - !ruby/object:Gem::Version
42
- version: '0.3'
42
+ version: '0.4'
43
43
  - - ">="
44
44
  - !ruby/object:Gem::Version
45
- version: 0.3.0
45
+ version: 0.4.2
46
46
  type: :runtime
47
47
  prerelease: false
48
48
  version_requirements: !ruby/object:Gem::Requirement
49
49
  requirements:
50
50
  - - "~>"
51
51
  - !ruby/object:Gem::Version
52
- version: '0.3'
52
+ version: '0.4'
53
53
  - - ">="
54
54
  - !ruby/object:Gem::Version
55
- version: 0.3.0
55
+ version: 0.4.2
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: rexle
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
60
  - - "~>"
61
61
  - !ruby/object:Gem::Version
62
- version: '1.3'
62
+ version: '1.4'
63
63
  - - ">="
64
64
  - !ruby/object:Gem::Version
65
- version: 1.3.30
65
+ version: 1.4.9
66
66
  type: :runtime
67
67
  prerelease: false
68
68
  version_requirements: !ruby/object:Gem::Requirement
69
69
  requirements:
70
70
  - - "~>"
71
71
  - !ruby/object:Gem::Version
72
- version: '1.3'
72
+ version: '1.4'
73
73
  - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: 1.3.30
75
+ version: 1.4.9
76
76
  description:
77
- email: james@r0bertson.co.uk
77
+ email: james@jamesrobertson.eu
78
78
  executables: []
79
79
  extensions: []
80
80
  extra_rdoc_files: []
@@ -100,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
100
100
  version: '0'
101
101
  requirements: []
102
102
  rubyforge_project:
103
- rubygems_version: 2.5.1
103
+ rubygems_version: 2.6.8
104
104
  signing_key:
105
105
  specification_version: 4
106
106
  summary: Rexslt is an XSLT processor written purely in Ruby
metadata.gz.sig CHANGED
Binary file