blob: ec271505ad7d15952beca768e9f0ba667dc908bb [file] [log] [blame]
<?xml version="1.0" ?>
<!--+
| Sample Schematron schema for the ZValidationTest
|
| Pass this file as a first argument on the command line to ZValidationTest
|
| Ivelin Ivanov, ivelin@apache.org
| CVS $Id: zxmlform-sch-report-test.xml,v 1.1 2003/04/26 12:09:44 stephan Exp $
+-->
<schema ns="http://xml.apache.cocoon/xmlform" xmlns="http://www.ascc.net/xml/schematron">
<title>Schema for the XML Form example</title>
<phase id="New">
<p>For creating new documents.</p>
<active pattern="mini"/>
</phase>
<phase id="Draft">
<p>For fast validation of draft documents.</p>
<active pattern="required" />
</phase>
<phase id="Full">
<p>For final validation and tracking some tricky problems.</p>
<active pattern="mini" />
<active pattern="required" />
<active pattern="extra" />
</phase>
<pattern name="A Simple Validation Pattern" id="mini">
<rule context="name">
<assert test="string-length(.) > 3" diagnostics="dname dcount">Animal name should be at least 4 characters.</assert>
<assert test="string-length(.) &lt; 10">Animal name should be less than 10 characters.</assert>
</rule>
<rule context="scope">
<assert test="normalize-space(.) = 'session' or normalize-space(.) = 'request'">Scope should be request or session.</assert>
</rule>
</pattern>
<pattern name="Required Validation Pattern" id="required">
<rule context="count">
<assert test="number(.) > 0" diagnostics="dcount">The counter should be > 0.</assert>
</rule>
</pattern>
<pattern name="Extra Simple Validation Pattern" id="extra">
a pattern
<rule context="/personalInfo/type"> a rule
<assert test="text(.) = 'mammal'">Animal type should be mammal.</assert>
<report test="text(.) != 'mammal'">Animal is not mammal.</report>
</rule>
</pattern>
<diagnostics>
<diagnostic id="dname">
Animals rarely have names shorter than 5 characters.
Dog and Cat are among the rare exceptions.
All right, all right, don't hold me to these words, this is just a sloppy test after all.
</diagnostic>
<diagnostic id="dcount">
The animal counter simply keeps track of the number of times this animal was visited .
</diagnostic>
</diagnostics>
</schema>