blob: b8dcd38a19f097f8c82259b85265395a90b9ab0b [file] [log] [blame]
<?xml version="1.0" ?>
<!--
Validating Schematron schema for the xmlform example wizard
Schematron Schema language home page:
http://www.ascc.net/xml/schematron/
Author: Ivelin Ivanov, ivelin@apache.org, April 2002
-->
<schema ns="http://xml.apache.cocoon/xmlform"
xmlns="http://www.ascc.net/xml/schematron">
<title>Schema for the XML Form example</title>
<phase id="userIdentity">
<p>For user identity information.</p>
<active pattern="user"/>
</phase>
<phase id="deployment">
<p>For deployment info page.</p>
<active pattern="dep" />
</phase>
<phase id="system">
<p>For system info page.</p>
<active pattern="sys" />
</phase>
<phase id="confirm">
<p>For final total validation and tracking some tricky problems.</p>
<active pattern="user" />
<active pattern="dep" />
<active pattern="sys" />
</phase>
<pattern name="User Info Validation Pattern" id="user">
<rule context="/firstName">
<assert test="string-length(.) &gt; 3">First name <anametag/>
<wrapper>should</wrapper> be at least 4 characters.</assert>
<assert test="string-length(.) &lt; 20">First name should be less
than 20 characters.</assert>
</rule>
<rule context="/lastName">
<assert test="string-length(.) &gt; 3">Last name should be at least
4 characters.</assert>
<assert test="string-length(.) &lt; 20">Last name should be less
than 20 characters.</assert>
</rule>
<rule context="/email">
<assert test="contains( string(.),'@')">Email format is invalid.</assert>
</rule>
<rule context="/age">
<assert test="number() &gt; 0 and number(.) &lt; 200">Age should be
a reasonably big positive number.</assert>
</rule>
</pattern>
<pattern name="Deployment Information Validation Pattern" id="dep">
<rule context="/number">
<assert test="number() &gt; 0">The number of deployments must be
non-negative ( hopefully positive :-> ) .</assert>
</rule>
<rule context="/">
<!--
If the site is to be published, then verify the URL.
Note: This assertion demonstrates the unique ability of
Schematron to test document node dependencies.
This is not possible to do with XML Schema and Relax NG.
-->
<assert
test="not(string(publish) = 'true') or (starts-with(liveUrl, 'http://') and contains( string(liveUrl),'.') ) "
>The URL of the published site is invalid.</assert>
</rule>
</pattern>
<pattern name="System Information Validation Pattern" id="sys">
<rule context="/system/@ram">
<assert test="number() &gt; 0">The RAM value should be a positive
number, denoting the memory in MB (e.g. 128, 512, etc.).</assert>
</rule>
</pattern>
</schema>