schematron 0.1.2 → 1.0.0

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.
data/.semver ADDED
@@ -0,0 +1,5 @@
1
+ ---
2
+ :special: ""
3
+ :major: "1"
4
+ :minor: "0"
5
+ :patch: "0"
data/README.md CHANGED
@@ -3,12 +3,12 @@ ISO Schematron
3
3
 
4
4
  Ruby gem for validating XML against schematron schema
5
5
 
6
- Uses [ISO Schematron](http://www.schematron.com) version: 2008-07-28
6
+ Uses [ISO Schematron](http://www.schematron.com) version: 2010-01-25
7
7
 
8
8
  Installation
9
9
  ------------
10
+
10
11
  % gem install schematron
11
- The rubyforge gem is deprecated. [Use gemcutter](http://gemcutter.org/gems/schematron).
12
12
 
13
13
  Command line example
14
14
  -------------------
@@ -43,8 +43,8 @@ Ruby API example
43
43
 
44
44
  ---
45
45
 
46
- Copyright © 2009, [Francesco Lazzarino](mailto:flazzarino@gmail.com).
46
+ Copyright © 2009-2010 [Francesco Lazzarino](mailto:flazzarino@gmail.com).
47
47
 
48
48
  Sponsored by [Florida Center for Library Automation](http://www.fcla.edu).
49
49
 
50
- See LICENSE.txt for terms.
50
+ See LICENSE.txt for terms.
data/bin/stron CHANGED
@@ -6,22 +6,29 @@ require 'schematron'
6
6
 
7
7
  include LibXML
8
8
 
9
+ if __FILE__ == $0
10
+ XML.default_line_numbers = true
9
11
 
10
- puts "Usage: stron [schematron] [instance doc]" if ARGV.size != 2
12
+ begin
11
13
 
12
- # use the line numbers
13
- XML.default_line_numbers = true
14
+ # get args
15
+ schema_file = ARGV.shift or raise "schematron file required"
16
+ instance_file = ARGV.shift or raise "instance doc file required"
14
17
 
15
- # Get sch and xml from command line
16
- schema_doc = XML::Document.file ARGV[0]
17
- instance_doc = XML::Document.file ARGV[1]
18
+ # parse the xml
19
+ schema_doc = XML::Document.file schema_file
20
+ instance_doc = XML::Document.file instance_file
21
+ stron = Schematron::Schema.new schema_doc
22
+
23
+ # validate
24
+ stron.validate(instance_doc).each do |error|
25
+ puts '%s "%s" on line %d: %s' % error.values_at(:type, :name, :line, :message)
26
+ end
27
+
28
+ rescue => e
29
+ puts "Usage: stron [schematron] [instance doc]"
30
+ puts e.message
31
+ exit 1
32
+ end
18
33
 
19
- stron = Schematron::Schema.new schema_doc
20
- stron.validate(instance_doc).each do |error|
21
- puts '%s "%s" on line %d: %s' % [
22
- error[:type],
23
- error[:name],
24
- error[:line],
25
- error[:message]
26
- ]
27
34
  end
@@ -136,7 +136,8 @@
136
136
 
137
137
 
138
138
  <!-- Suppress uses of abstract patterns -->
139
- <xslt:template match="iso:pattern[@is-a]" mode="iae:go" >
139
+ <xslt:template match="iso:pattern[@is-a]" mode="iae:go" >
140
+
140
141
  <xslt:comment>Start pattern based on abstract <xslt:value-of select="@is-a"/></xslt:comment>
141
142
 
142
143
  <xslt:call-template name="iae:abstract-to-real" >