dynarex 1.1.3 → 1.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/dynarex.rb +13 -2
- metadata +1 -1
data/lib/dynarex.rb
CHANGED
@@ -9,10 +9,11 @@ require 'line-tree'
|
|
9
9
|
require 'rexle'
|
10
10
|
require 'rexle-builder'
|
11
11
|
require 'rexslt'
|
12
|
+
require 'recordx-xslt'
|
12
13
|
|
13
14
|
class Dynarex
|
14
15
|
|
15
|
-
attr_accessor :format_mask, :delimiter, :schema
|
16
|
+
attr_accessor :format_mask, :delimiter, :xslt_schema, :schema
|
16
17
|
|
17
18
|
#Create a new dynarex document from 1 of the following options:
|
18
19
|
#* a local file path
|
@@ -25,7 +26,7 @@ class Dynarex
|
|
25
26
|
def initialize(location=nil)
|
26
27
|
@delimiter = ' '
|
27
28
|
open(location) if location
|
28
|
-
|
29
|
+
@dynarex_xslt = RecordxXSLT.new
|
29
30
|
end
|
30
31
|
|
31
32
|
def add(x)
|
@@ -227,9 +228,19 @@ EOF
|
|
227
228
|
!@doc.root.element("records/*[@id='#{id}']").nil?
|
228
229
|
end
|
229
230
|
|
231
|
+
def to_xslt()
|
232
|
+
@dynarex_xslt.schema = @schema
|
233
|
+
@dynarex_xslt.to_xslt
|
234
|
+
end
|
235
|
+
|
230
236
|
def xpath(x)
|
231
237
|
@doc.root.xpath x
|
232
238
|
end
|
239
|
+
|
240
|
+
def xslt_schema(s)
|
241
|
+
@dynarex_xslt.xslt_schema = s
|
242
|
+
self
|
243
|
+
end
|
233
244
|
|
234
245
|
private
|
235
246
|
|