rexslt 0.5.13 → 0.5.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/rexslt.rb +22 -9
- metadata +2 -2
- 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: 74ebd52f673bd7270758857d59ec2ef4fff46c0e
|
4
|
+
data.tar.gz: 318604f1ffed35693c27ad3cda2f0e47a3591e3d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 906c59a61bd6c02a7e5c8b5dafbd1c89bd95fd945025a052dd9513ca0adc1afd8798c6ce938c93a60ffcfe255ec1f4b2cd5171ad30c0d52a8f549229e227a6d5
|
7
|
+
data.tar.gz: 457de1d3f878a3b904d0660831031fc11211657bd1d9fdb34d29f80aa86eecd66d60c1c37e09d79691c725b063377c0161ba0da9f3b1186d21ae4fb96ff1853c
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/rexslt.rb
CHANGED
@@ -39,6 +39,10 @@ class Rexslt
|
|
39
39
|
|
40
40
|
def initialize(xsl, xml, params={})
|
41
41
|
|
42
|
+
## debugging variables
|
43
|
+
|
44
|
+
@rn = 0
|
45
|
+
@rre = 0
|
42
46
|
|
43
47
|
super()
|
44
48
|
@options = {}
|
@@ -221,8 +225,9 @@ class Rexslt
|
|
221
225
|
end
|
222
226
|
|
223
227
|
new_element = Rexle::Element.new(name) # .add_text(x.value.strip)
|
228
|
+
#jr060416 doc_element.text = element.text if element.text
|
229
|
+
new_element.text = element.text if element.text
|
224
230
|
|
225
|
-
doc_element.text = element.text if element.text
|
226
231
|
read_node(x, element, new_element, indent, i)
|
227
232
|
doc_element.add new_element
|
228
233
|
indent_after(element, x, doc_element, indent) if @indent == true
|
@@ -342,6 +347,12 @@ class Rexslt
|
|
342
347
|
x.to_s.strip.length > 0 ? ' ' * indent : ''
|
343
348
|
end
|
344
349
|
|
350
|
+
|
351
|
+
# Reads an XSL node which is either an XSL element, a string or a comment
|
352
|
+
# template_node: XSL node
|
353
|
+
# element: XML node
|
354
|
+
# doc_element: target document element
|
355
|
+
#
|
345
356
|
def read_node(template_node, element, doc_element, indent, i=0)
|
346
357
|
|
347
358
|
procs = {
|
@@ -351,6 +362,8 @@ class Rexslt
|
|
351
362
|
}
|
352
363
|
|
353
364
|
template_node.children.each_with_index do |x,j|
|
365
|
+
|
366
|
+
# x: an XSL element, or a string or a comment
|
354
367
|
method(procs[x.class.to_s]).call(element, x, doc_element, indent, i)
|
355
368
|
end
|
356
369
|
|
@@ -360,7 +373,6 @@ class Rexslt
|
|
360
373
|
#
|
361
374
|
def read_raw_text(element, x, doc_element, raw_indent, i)
|
362
375
|
|
363
|
-
|
364
376
|
#val = @indent == true ? padding(doc_element, raw_indent, x) : ''
|
365
377
|
if x.to_s.strip.length > 0 then
|
366
378
|
|
@@ -372,9 +384,13 @@ class Rexslt
|
|
372
384
|
|
373
385
|
end
|
374
386
|
|
387
|
+
# element: xml element
|
388
|
+
# x: xsl element
|
389
|
+
# doc_element:
|
390
|
+
#
|
375
391
|
def read_raw_element(element, x, doc_element, indent, j)
|
376
|
-
|
377
|
-
method_name = x.name.gsub(/[:-]/,'_').to_sym
|
392
|
+
|
393
|
+
method_name = x.name.gsub(/[:-]/,'_').to_sym
|
378
394
|
|
379
395
|
if @xsl_methods.include? method_name then
|
380
396
|
|
@@ -391,7 +407,6 @@ class Rexslt
|
|
391
407
|
new_indent = indent + 1 if @indent == true
|
392
408
|
|
393
409
|
new_element = x.clone
|
394
|
-
#doc_element.add new_element
|
395
410
|
|
396
411
|
new_element.attributes.each do |k,raw_v|
|
397
412
|
|
@@ -409,11 +424,9 @@ class Rexslt
|
|
409
424
|
|
410
425
|
end
|
411
426
|
end
|
412
|
-
|
427
|
+
|
413
428
|
if x.children.length > 0 then
|
414
429
|
|
415
|
-
|
416
|
-
|
417
430
|
indent_before(element, x, doc_element, new_indent, j) if @indent == true
|
418
431
|
|
419
432
|
read_node(x, element, new_element, new_indent, j)
|
@@ -436,6 +449,7 @@ class Rexslt
|
|
436
449
|
doc_element.add val
|
437
450
|
|
438
451
|
end
|
452
|
+
|
439
453
|
end
|
440
454
|
|
441
455
|
end
|
@@ -536,7 +550,6 @@ class Rexslt
|
|
536
550
|
|
537
551
|
# using the 1st template
|
538
552
|
xpath = String.new @templates.to_a[0][0]
|
539
|
-
|
540
553
|
out = read_node(@templates.to_a[0][-1], doc_xml.element(xpath), @doc.root, indent)
|
541
554
|
|
542
555
|
out
|
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.5.
|
4
|
+
version: 0.5.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
31
31
|
38j2+6ULVWalsVein3whb7qB6IOvxoSqjz6n7jAKFGHovoXPUqpv5y5Yor23rTrn
|
32
32
|
0YwisIc3UkL30g==
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date: 2016-04-
|
34
|
+
date: 2016-04-06 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rxfhelper
|
metadata.gz.sig
CHANGED
Binary file
|