I understand that Saxon SA is able to do this kind of processing, including at least basic arithmetic.
If I've been misled, please let me know.
I do have a schema for the structure below, and all the relevant values here have been defined as xs:unsignedInt.
So, given a sample XML structure:
Code: Select all
<Length Value="1150" />
<Item Offset="0" Value="12" />
<Item Offset="754" Value="34" />
<Item Offset="935" Value="56" />
<Item Offset="1150" Value="78" />
<Widget Start="0" End="1150" Value="987" />
I would like to perform the following kinds of limit/bound checking:
(a) Check that all of the Item Offsets are <= Length's Value.
(b) Check that exactly one of the Offsets of Item = 0.
(c) Check that exactly one of the Offsets of Item = Length's Value.
(The offsets of Item are probably in ascending order, but I'm not
sure I can guarantee that.)
(d) Check that the Start value of Widget is >= 0.
(e) Check that the End value of Widget is <= Length's Value.
(f) Or, instead of (d) and (e), check that Widget's End-Start <= Length's Value.
I would like to do the checking during validation, not at transformation time (since the file gets used elsewhere without being transformed).
Would someone get me started with some examples of how to do the above checks, and point me to some other examples and documentation?