dynarex 1.1.7 → 1.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. data/lib/dynarex.rb +14 -4
  2. metadata +2 -2
@@ -227,14 +227,24 @@ EOF
227
227
  !@doc.root.element("records/*[@id='#{id}']").nil?
228
228
  end
229
229
 
230
- def to_xslt()
231
- DynarexXSLT.new(schema: @schema, xslt_schema: @xslt_schema).to_xslt
230
+ def to_xslt(opt={})
231
+ h = {limit: -1}.merge(opt)
232
+ xslt = DynarexXSLT.new(schema: @schema, xslt_schema: @xslt_schema).to_xslt
233
+
234
+ if h[:limit] > 0 then
235
+ s = "[position() < #{h[:limit]}]"
236
+ doc = Rexle.new(xslt)
237
+ e = doc.root.element('xsl:template/channel/*[2]')
238
+ e.attributes[:select] = e.attributes[:select] + s
239
+ return doc.xml pretty: true
240
+ end
241
+
242
+ return xslt
232
243
  end
233
244
 
234
245
  def xpath(x)
235
246
  @doc.root.xpath x
236
- end
237
-
247
+ end
238
248
 
239
249
  private
240
250
 
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: dynarex
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.1.7
5
+ version: 1.1.8
6
6
  platform: ruby
7
7
  authors:
8
8
  - James Robertson
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2012-03-15 00:00:00 +00:00
13
+ date: 2012-03-16 00:00:00 +00:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency