xml_to_xsl 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/xml_to_xsl.rb +6 -16
- metadata +28 -24
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f67709f2892f794d15dcb2c7ac2e35592bf590dc1f2c3c0c2d34871d88033002
|
4
|
+
data.tar.gz: ab0145d549f5d3509e0202a5a1d9991da0e95729d45517da9980a21ef45c2dee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a1c6f3e166e3018c7964f83007dc41452115722441bad984bed03439813cccadc05b271762e1678f938a479c79f104386c9f6f642c3fe6c578cf0b755046e02c
|
7
|
+
data.tar.gz: 53135f3743bb8448bb29d4a55a2c8be8e14db048091f409e4d792f7cf4d7d422d304e63102bdbd67684fe0426da317a5e5169ee417dd9ae3f9a04d114de420e9
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/xml_to_xsl.rb
CHANGED
@@ -2,21 +2,16 @@
|
|
2
2
|
|
3
3
|
# file: xml_to_xsl.rb
|
4
4
|
|
5
|
-
require '
|
6
|
-
|
5
|
+
require 'rexle'
|
7
6
|
|
8
7
|
|
9
8
|
class XMLToXSL
|
10
9
|
|
11
|
-
include REXML
|
12
|
-
|
13
10
|
attr_reader :to_xsl
|
14
11
|
|
15
|
-
|
16
12
|
def initialize(xml)
|
17
13
|
|
18
|
-
doc =
|
19
|
-
|
14
|
+
doc = Rexle.new(xml)
|
20
15
|
|
21
16
|
@to_xsl = "<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform'"\
|
22
17
|
" version='1.0'>
|
@@ -33,7 +28,6 @@ class XMLToXSL
|
|
33
28
|
</xsl:stylesheet>"
|
34
29
|
|
35
30
|
end
|
36
|
-
|
37
31
|
|
38
32
|
private
|
39
33
|
|
@@ -48,7 +42,7 @@ class XMLToXSL
|
|
48
42
|
node.elements.each do |child|
|
49
43
|
|
50
44
|
|
51
|
-
if child.length > 1
|
45
|
+
if child.children.length > 1
|
52
46
|
|
53
47
|
r << build_template(child)
|
54
48
|
|
@@ -65,9 +59,7 @@ class XMLToXSL
|
|
65
59
|
end
|
66
60
|
r.join
|
67
61
|
|
68
|
-
end
|
69
|
-
|
70
|
-
|
62
|
+
end
|
71
63
|
|
72
64
|
def build_template(element)
|
73
65
|
|
@@ -80,11 +72,8 @@ class XMLToXSL
|
|
80
72
|
|
81
73
|
end
|
82
74
|
|
83
|
-
|
84
|
-
|
85
75
|
def build_value(element,parent)
|
86
76
|
|
87
|
-
|
88
77
|
"\n
|
89
78
|
<xsl:element name='#{parent.name}'>
|
90
79
|
#{write_attributes(parent.attributes).join("\n")}
|
@@ -99,15 +88,16 @@ class XMLToXSL
|
|
99
88
|
#{write_attributes(element.attributes).join("\n")}
|
100
89
|
<xsl:value-of select='.' />"
|
101
90
|
|
102
|
-
|
103
91
|
end
|
104
92
|
|
105
93
|
def write_attributes(attr)
|
94
|
+
|
106
95
|
attr.map do |key, val|
|
107
96
|
" <xsl:attribute name='#{key}'>
|
108
97
|
<xsl:value-of select='@#{key}'/>
|
109
98
|
</xsl:attribute>"
|
110
99
|
end
|
100
|
+
|
111
101
|
end
|
112
102
|
|
113
103
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xml_to_xsl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -10,31 +10,35 @@ bindir: bin
|
|
10
10
|
cert_chain:
|
11
11
|
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
+
AaOBijCBhzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQUYXNAU3ju
|
26
|
+
oPrQEMXEDOZzzeAWlXowJgYDVR0RBB8wHYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0
|
27
|
+
c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1hc3RlckBqYW1lc3JvYmVydHNvbi5ldTAN
|
28
|
+
BgkqhkiG9w0BAQsFAAOCAYEAPIP0PIXbIYN4oyWq0YrpXknI8apLioTFjPejq+Kd
|
29
|
+
9d2x2aygAG7SzWO97+P3TIMknwBJiuvXtgmFliBgOWLJ3kMJjXz0hOn/fF5y7a23
|
30
|
+
QxJuBq4dYgYObrWmz1vjTE4M18PJxiy1n49SQGUeQA5ARuTZPPM71jcdHsW5SJ7g
|
31
|
+
PzyRdAgrjM5FHvjY7NtqT0P1ePDDSsOZjs9+tsL7rPl1REK+ftW7D4GRKsTPJjHg
|
32
|
+
4stAvgPU8By9dP40tOyiXCmS4xlyhAw5xXzNyhBPkhXcgg5XCjz2R0p3OYcoQkYq
|
33
|
+
cf1sP3OE4k2XbFMEXYJEkKmwnlzkpeQeS0m2a6a8fSM7s9wf4Pjc3jS+WgIck6Fz
|
34
|
+
RGVhhIwGfgJM5C6cNQetboa0PeBcwvo/XTLaW+2Rmh1T8vcuQ5PCK8dgA8wXRSoN
|
35
|
+
g3+1FS3lzjIYR2kWhnwWKZvlNTRCGWBfBt1CvrzJ8mUHT9u7m1SqoOXv7s9jSdVR
|
36
|
+
h+IYf3YHX4HJIKbjMc601ZF1
|
33
37
|
-----END CERTIFICATE-----
|
34
|
-
date:
|
38
|
+
date: 2021-02-21 00:00:00.000000000 Z
|
35
39
|
dependencies: []
|
36
40
|
description:
|
37
|
-
email:
|
41
|
+
email: digital.robertson@gmail.com
|
38
42
|
executables: []
|
39
43
|
extensions: []
|
40
44
|
extra_rdoc_files: []
|
@@ -60,7 +64,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
60
64
|
version: '0'
|
61
65
|
requirements: []
|
62
66
|
rubyforge_project:
|
63
|
-
rubygems_version: 2.
|
67
|
+
rubygems_version: 2.7.10
|
64
68
|
signing_key:
|
65
69
|
specification_version: 4
|
66
70
|
summary: Creates XSLT from XML
|
metadata.gz.sig
CHANGED
Binary file
|