rexslt 0.6.12 → 0.6.13

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
  SHA256:
3
- metadata.gz: 8677062cfbfef49a97de56c7fb501abf1f57c48bbea804ec13d4a6dcb93d69ed
4
- data.tar.gz: dab58fa40b0365bef22573ec58c7b97cf86a5c4fdeddbd103395b2655a887e02
3
+ metadata.gz: b6b3abb16a3aadcc6df66d725fe37177fe617b9a9c4f2c78358a1504e0a8d3a8
4
+ data.tar.gz: 0e8bf4584269ba064755b1426f9f9ad1b9abb009af5398076df0f9873470c0cf
5
5
  SHA512:
6
- metadata.gz: f94cb4e9621cda90f7e4e785fd7b45d53b94734bc3e3f01b8713a45faad7f9fdaaf5cefb478917abad1ff4c3533e40bfc963061b2436c401de011d6a5676841f
7
- data.tar.gz: 6fbef82369e5534e05928a13b7f3ff01562767d65bded4e32bc8fbba26754271e7d5f1abd1d32c7a79df252e70705d91760a3863f91bcf76a8acf9add5a8cdf4
6
+ metadata.gz: 0f636b79d68d8a439515d82aa40a971e2f80e4274a3b5f82cafdabc1b949590655133a4bff5c986333a70ff1edf0767655f947021c0d2477449775b3aa403611
7
+ data.tar.gz: cb166cdc0bf9cd862c9a832bc6a1d282ec02b6405e7192989e8188deadb61da9bcb72569ae069e58e793d78423c5d1aed26b16a33e151a409e6f27d685dda83b
Binary file
data.tar.gz.sig CHANGED
@@ -1,2 +1 @@
1
- w���`uE&-�?KH�+|�P&B6ǐ Z ��6�.��xBTe ��NnXB?����1�?�j�
2
- ���4e���n�ɾڅ�v3� ;H78H�� 8q[z8�ZخC��ȉ�a�s����&�j�t��r����2]NST$@8�3�&x�c�.�:��{d���t��^�21:ӈ��W��D
1
+ `N0��ns)y(u��(̗��n���3`!~
2
+ �K2��AG4�S'I��U��P�/)��~�$�#�1��aF u&��V�+�̯?>���9���!�G��<�?X',��
@@ -11,6 +11,7 @@ require 'logger'
11
11
  #
12
12
  # 01-Feb-2019: bug fix: new line characters are no longer stripped
13
13
  # between XSL elements
14
+ # bug fix: An attribute variable value is now returned correctly
14
15
  # 19-Jan-2018: feature: Implemented Rexslt#to_xml which returns pretty XML
15
16
  # 16-Sep-2017: improvement: all predicates in an xsl:choose
16
17
  # condition now must be true
@@ -89,7 +90,7 @@ class Rexslt
89
90
  def to_doc(); @doc; end
90
91
 
91
92
  def to_xml()
92
- @doc.root.xml(pretty: true).sub(/<root3>\n/,'').sub(/<\/root3>$/m,'')
93
+ @doc.root.xml(pretty: true).sub(/<root4>/,'').sub(/<\/root4>$/m,'')
93
94
  end
94
95
 
95
96
  private
@@ -245,6 +246,24 @@ class Rexslt
245
246
  end
246
247
 
247
248
  end
249
+
250
+ def xsl_cdata(element, x, doc_element, indent, i)
251
+ puts ('cdata x: ' + element.inspect) if @debug
252
+
253
+ new_element = Rexle::CData.new(x.value.to_s)
254
+
255
+ read_node(x, element, new_element, indent, i)
256
+ doc_element.add new_element
257
+ end
258
+
259
+ def xsl_comment(element, x, doc_element, indent, i)
260
+ #puts ('comment x: ' + element.inspect) if @debug
261
+
262
+ new_element = Rexle::Comment.new(x.value.to_s)
263
+
264
+ read_node(x, element, new_element, indent, i)
265
+ doc_element.add new_element
266
+ end
248
267
 
249
268
  def xsl_copy_of(element, x, doc_element, indent, i)
250
269
  #jr251012 indent = 1 unless indent
@@ -264,12 +283,15 @@ class Rexslt
264
283
  name = x.attributes[:name]
265
284
  variable = name[/^\{(.*)\}$/,1]
266
285
 
286
+ puts 'variable: ' + variable.inspect if @debug
287
+
267
288
  if variable then
268
289
  name = element.element(variable)
269
290
  end
270
291
 
271
292
  new_element = Rexle::Element.new(name) # .add_text(x.value.strip)
272
- new_element.text = element.text if element.text
293
+ puts 'element.text: ' + element.to_s.inspect
294
+ new_element.text = element.text.to_s.strip
273
295
 
274
296
  read_node(x, element, new_element, indent, i)
275
297
  doc_element.add new_element
@@ -352,9 +374,11 @@ class Rexslt
352
374
  end
353
375
 
354
376
  def indent_after(element, x, doc_element, prev_indent)
377
+
378
+ puts 'indent? : ' + @indent.inspect if @debug
355
379
 
356
380
  if @indent == true then
357
- doc_element.add_text "\n" + ' ' * (prev_indent > 0 ? prev_indent - 1 : prev_indent)
381
+ doc_element.add_text ' ' * (prev_indent > 0 ? prev_indent - 1 : prev_indent)
358
382
  end
359
383
  end
360
384
 
@@ -390,7 +414,10 @@ class Rexslt
390
414
  :ignore
391
415
  end
392
416
 
393
- method(name).call(element, x, doc_element, indent, i)
417
+ r2 = method(name).call(element, x, doc_element, indent, i)
418
+ puts 'r2: ' + r2.inspect if @debug
419
+ r2
420
+
394
421
  end
395
422
 
396
423
  end
@@ -436,20 +463,28 @@ class Rexslt
436
463
  new_element.attributes.each do |k,raw_v|
437
464
 
438
465
  v = raw_v.is_a?(Array) ? raw_v.join(' ') : raw_v
439
-
466
+
467
+ puts 'v: ' + v.inspect if @debug
468
+
440
469
  if v[/{/] then
441
470
 
442
471
  v.gsub!(/(\{[^\}]+\})/) do |x2|
443
472
 
444
473
  xpath = x2[/\{([^\}]+)\}/,1]
445
- text = element.text(xpath)
474
+ puts 'element.text(xpath): ' + element.text(xpath).inspect if @debug
475
+ text = element.text(xpath).to_s.strip
476
+ puts 'text: ' + text.inspect if @debug
446
477
  text ? text.clone : ''
447
478
 
448
479
  end
480
+
481
+ puts '2. v: ' + v.inspect if @debug
449
482
 
450
483
  end
451
484
  end
452
-
485
+
486
+ puts 'x.children.length: ' + x.children.length.inspect if @debug
487
+
453
488
  if x.children.length > 0 then
454
489
 
455
490
  indent_before(element, x, doc_element, new_indent, j) if @indent == true
@@ -468,31 +503,43 @@ class Rexslt
468
503
 
469
504
  else
470
505
 
471
- indent_before(element, x, doc_element, new_indent, j) if @indent == true
506
+ indent_before(element, x, new_element, new_indent, j) if @indent == true
472
507
 
473
508
  val = @indent == true ? x.to_s : x.to_s
474
- doc_element.add val
509
+ #jr020219 doc_element.add val
510
+ doc_element.add new_element
475
511
 
476
512
  end
477
-
513
+
478
514
  end
515
+ #new_element
516
+ #puts 'attributes: ' + new_element.attributes.inspect if @debug
479
517
 
480
518
  end
481
519
 
482
- def value_of(x, element, i)
520
+ def value_of(x, elementx, i)
521
+
522
+ puts 'value_of: ' + elementx.to_s.inspect if @debug
483
523
 
484
524
  field = x.attributes[:select]
485
525
 
486
526
  o = case field
487
527
  when '.'
488
- element.value
528
+ elementx.value
489
529
  when /^\$/
490
530
  @param[field[/^\$(.*)/,1]]
491
531
  when 'position()'
492
532
  i.to_s
493
533
  else
494
- ee = element.text(field)
495
- ee
534
+ r = elementx.element(field)
535
+ if r.is_a? Rexle::Element::Attribute
536
+ r.value.to_s
537
+ elsif r.is_a? Rexle::Element
538
+ r.texts.join
539
+ else
540
+ ''
541
+ end
542
+
496
543
  end
497
544
 
498
545
  end
@@ -516,7 +563,8 @@ class Rexslt
516
563
  end
517
564
 
518
565
  def xsl_value_of(element, x, doc_element, indent, i)
519
-
566
+
567
+ #puts 'xsl_value_of: ' + x.inspect if @debug
520
568
  s = value_of(x, element,i)
521
569
  doc_element.add_text s
522
570
  doc_element
@@ -530,7 +578,7 @@ class Rexslt
530
578
 
531
579
  doc_xml = xml.is_a?(Rexle) ? xml : Rexle.new(xml)
532
580
 
533
- @doc_xsl = raw_xsl.is_a?(Rexle) ? raw_xsl : Rexle.new(raw_xsl)
581
+ @doc_xsl = raw_xsl.is_a?(Rexle) ? raw_xsl : Rexle.new(raw_xsl.gsub(/(?<=\<\/xsl:text>)[^<]+/,''))
534
582
  puts 'after @doc_xsl'.info if @debug
535
583
 
536
584
  #jr2040516 filter_out_spaces @doc_xsl.root
@@ -541,7 +589,7 @@ class Rexslt
541
589
 
542
590
  previous_indent = 0
543
591
  @xsl_methods = %i(apply_templates value_of element if choose when copy_of
544
- attribute for_each text output call_template).map do |x|
592
+ attribute for_each text output call_template comment cdata).map do |x|
545
593
  ('xsl_' + x.to_s).to_sym
546
594
  end
547
595
 
@@ -557,6 +605,7 @@ class Rexslt
557
605
  end
558
606
 
559
607
  h = @doc_xsl.root.element("xsl:output/attribute::*")
608
+ puts 'h: ' + h.inspect if @debug
560
609
  puts 'after h'.info if @debug
561
610
 
562
611
  if h and ((h[:method] and h[:method].downcase == 'html') \
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.12
4
+ version: 0.6.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -35,7 +35,7 @@ cert_chain:
35
35
  lsqJ2/yU8bVVS+tkDVmCLdDn+RMoPYrLqZGbWwm5913h255DeUC6/qKofxWvR+XC
36
36
  hyIDI2yf0ueF+Lirvch+gr7J
37
37
  -----END CERTIFICATE-----
38
- date: 2019-02-01 00:00:00.000000000 Z
38
+ date: 2019-02-02 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: rxfhelper
metadata.gz.sig CHANGED
Binary file