cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Delis, Christopher E." <cede...@uillinois.edu>
Subject RE: XMLForm Schematron question
Date Wed, 26 Mar 2003 17:20:13 GMT
sheesh!  turned out to be a stupid error on my part (i should've posted the
whole xml file and you probably would've found it right away).  thanks for
helping!  here's what works:

<?xml version="1.0" ?>
<schema ns="http://xml.apache.cocoon/xmlform"
        xmlns="http://www.ascc.net/xml/schematron">
        <title>Schema for the Password Form</title>
        <phase id="passwordView">
                <p>For password information.</p>
                <active pattern="password"/>
        </phase>
        <pattern name="Password Validation Pattern" id="password">
                <rule context="/password">
                        <assert test="string-length(.) &gt; 3">Password
                                should be at least 4 characters.</assert>
                        <assert test="string-length(.) &lt; 60">Password
should be less
                                than 60 characters.</assert>
                        <assert
test="string(.)=string(../password2)">Passwords do not match!</assert>
                </rule>
                <rule context="/password2">
                        <assert test="string-length(.) &gt; 3">Password
                                should be at least 4 characters.</assert>
                </rule>
        </pattern>
</schema>


> -----Original Message-----
> From: Joerg Heinicke [mailto:joerg.heinicke@gmx.de]
> Sent: Wednesday, March 26, 2003 10:58 AM
> To: cocoon-users@xml.apache.org
> Subject: Re: XMLForm Schematron question
> 
> 
> Hi Delis,
> 
> for an XML like
> 
> <root>
>    <password>mypassword</password>
>    <password2>mypassword</password2>
> </root>
> 
> I would use the following schematron:
> 
> <rule context="/root">
>    <assert test="string-length(password) > 5">must be > 5</assert>
>    <assert test="string-length(password) &lt; 60">must be 
> &lt; 60</assert>
>    <assert test="password = password2">password != password2</assert>
> </rule>
> 
> I didn't test it, but the above looks logical to me ;-) 
> Everything is pure 
> XSLT. But what you tried (../password2), should work also (if 
> context is 
> password). I guess there must something else wrong. E.g. 
> /password AND 
> /password2? How can an XML have two root nodes?
> 
> Regards,
> 
> Joerg
> 
> 
> Delis, Christopher E. wrote:
> > on a slightly different note, how does one reference 
> another rule context.
> > i.e.:
> > 
> > let's say i have two elts, "/password" and "/password2":
> > 
> >         <pattern name="Password Validation Pattern" id="password">
> >                 <rule context="/password">
> >                         <assert test="string-length(.) &gt; 5">Name
> >                                 should be at least 6 
> characters.</assert>
> >                         <assert test="string-length(.) &lt; 
> 60">Password
> > should be less
> >                                 than 60 characters.</assert>
> >                 </rule>
> >                 <rule context="/password2">
> >                         <assert test="string-length(.) &gt; 5">Name
> >                                 should be at least 6 
> characters.</assert>
> >                 </rule>
> >         </pattern>
> > 
> > ...how can i validate that "/password" and "/password2" are 
> equal in the
> > rule for "/password"?  i could use a predicate, but that 
> won't give the user
> > an error message (from an assert test).  perhaps, this 
> solution is just as
> > simple (i hope)? =-)  [i'm pretty sure i tried referencing 
> (../password2)
> > but it didn't seem to work.]
> 
> -- 
> 
> System Development
> VIRBUS AG
> Fon  +49(0)341-979-7419
> Fax  +49(0)341-979-7409
> joerg.heinicke@virbus.de
> www.virbus.de
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org


Mime
View raw message