| <?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(.) > 3">First name <anametag/> |
| <wrapper>should</wrapper> be at least 4 characters.</assert> |
| <assert test="string-length(.) < 20">First name should be less than |
| 20 characters.</assert> |
| </rule> |
| <rule context="/lastName"> |
| <assert test="string-length(.) > 3">Last name should be at least 4 characters.</assert> |
| <assert test="string-length(.) < 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() > 0 and number(.) < 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() > 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() > 0">The RAM value should be a positive |
| number, denoting the memory in MB (e.g. 128, 512, etc.).</assert> |
| </rule> |
| </pattern> |
| </schema> |