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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: e733075d76910d6d4d4b1ed87fa772338a9df329
4
- data.tar.gz: 4e7632e822f5afdf25275fcb4e5f745d27e31121
2
+ SHA256:
3
+ metadata.gz: f67709f2892f794d15dcb2c7ac2e35592bf590dc1f2c3c0c2d34871d88033002
4
+ data.tar.gz: ab0145d549f5d3509e0202a5a1d9991da0e95729d45517da9980a21ef45c2dee
5
5
  SHA512:
6
- metadata.gz: 3e0f55ceacd0179a0f3a8469deab34e474f0d5c7748cbd348685a5172441bb4ff4a84b414372f88bace745061109da06b5db693f5cc4d62c174e06844b121c3a
7
- data.tar.gz: c63c1d0d56604208a029db3bf800b4e0b6ef4fa5b02e7d24f91eee77d3b4e2e9fdc563bfc044d27c48ff98426ce95f4e58cf999edc7b71e46f9130220a005a45
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 'rexml/document'
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 = Document.new(xml)
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.1.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
  - |
12
12
  -----BEGIN CERTIFICATE-----
13
- MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
14
- YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
15
- 8ixkARkWAmV1MB4XDTE0MDkxNzIwMjYwN1oXDTE1MDkxNzIwMjYw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ldTAN
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: 2014-09-17 00:00:00.000000000 Z
38
+ date: 2021-02-21 00:00:00.000000000 Z
35
39
  dependencies: []
36
40
  description:
37
- email: james@r0bertson.co.uk
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.2.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