blob: 07d15c0fd86594641bc5012f9f7d8aaf9b393f8a [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<!--
Validating Schematron schema for the JXForms example wizard
Schematron Schema language home page:
http://www.ascc.net/xml/schematron/
-->
<schema ns="http://xml.apache.cocoon/jxforms" xmlns="http://www.ascc.net/xml/schematron">
<title>Schema for the JXForms 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 id="user" name="User Info Validation Pattern">
<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 id="dep" name="Deployment Information Validation Pattern">
<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 id="sys" name="System Information Validation Pattern">
<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>