1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<!--
A worked Schematron schema for the tutorial in spec/tutorial/.
Read a rule as: "for every node matching @context, check these assertions".
Remember that within one pattern a node is claimed by the FIRST matching
rule only, which is why the line-type checks below live together in one
pattern (they are deliberate alternatives) while the structural checks live
in a pattern of their own (they are independent).
-->
Invoice rules
Structure
An invoice must have an id.
An invoice must have a total.
An invoice must have at least one line.
This invoice has lines, which is unusual.
Line rules
<!--
These two rules are alternatives, on purpose: a discount line is checked
by the first rule and never reaches the second.
-->
A discount line must have a negative amount, but has .
Every line needs a qty.
Quantity must be positive, but is .
A normal line must not have a negative amount; use type="discount" for that.
Totals
Total is but the lines plus tax come to .
Quantity is the number of units ordered. It must be a positive number.
Amount is the line total in the invoice currency. Discounts are negative.