schematron 0.1.2 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.semver +5 -0
- data/README.md +4 -4
- data/bin/stron +21 -14
- data/{iso_impl → iso-schematron-xslt1}/iso_abstract_expand.xsl +2 -1
- data/iso-schematron-xslt1/iso_dsdl_include.xsl +1160 -0
- data/iso-schematron-xslt1/iso_schematron_message.xsl +55 -0
- data/{iso_impl → iso-schematron-xslt1}/iso_schematron_skeleton_for_xslt1.xsl +108 -36
- data/{iso_impl/iso_svrl.xsl → iso-schematron-xslt1/iso_svrl_for_xslt1.xsl} +16 -11
- data/iso-schematron-xslt1/readme.txt +83 -0
- data/lib/schematron.rb +3 -3
- data/schematron.gemspec +8 -27
- metadata +19 -9
- data/Rakefile +0 -14
- data/iso_impl/iso_dsdl_include.xsl +0 -989
- data/iso_impl/iso_schematron_skeleton_for_saxon.xsl +0 -1884
- data/iso_impl/iso_schematron_text.xsl +0 -126
data/.semver
ADDED
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:
|
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
|
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
|
-
|
12
|
+
begin
|
11
13
|
|
12
|
-
#
|
13
|
-
|
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
|
-
#
|
16
|
-
schema_doc = XML::Document.file
|
17
|
-
instance_doc = XML::Document.file
|
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" >
|