[
Lists Home |
Date Index |
Thread Index
]
From: "Rick Jelliffe" <ricko@allette.com.au>
> Your constraints would be specified in Schematron like this:
>
> <rule context="prop1[text()='ABC']" >
> <assert test="following-sibling::*[1][self::prop2]">
> When the value of "prop1" is ABC then "prop2" should follow "prop1"
> </assert>
> </rule>
>
> <rule context="prop1[text()='XYZ']" >
> <assert test="following-sibling::*[1][self::prop3]">"
> When the value of "prop1" is XYZ then "prop3" should follow "prop1"
> </assert>
> </rule>
Since when are attributes order-constrained?
> Note that you have expressed your constraints in a form that
> can be used directly to drive the assertions you want to make.
> Rather than trying to squeeze them into the form of a grammar,
> you can just use translate your XPaths fairly directly. This is
> commonly the case with Schematron assertion.
What an interesting world-view! If you "squeeze" constraints into the form
of a grammar you and others can visualize the structure of the document,
i.e., the things that can be said. If you squeeze grammar into the form of
constraints you just have a list of things that can't be said.
Of course, grammars plus assertions are more powerful than grammars alone.
No argument there. And XSD/RELAX NG + Schematron is a very appealing
combination. But my world-view is that anything that can be specified by a
grammar should be. Grammars are constructive. They can, and commonly are,
used to generate user assistance to document authors, forms for data entry
and readable documentation. Can't do that with assertions.
>There is a free drag-and-drop validator for XSD, RELAX NG and Schematron
>for Windows at http://www.topologi.com/
And very nice it is!
Bob
|