You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Ugo Cei <u....@cbim.it> on 2003/01/13 23:23:40 UTC

[XMLForm,Validation] Testing for equality

This must be something really stupid, but I tried to make it work for 
over an hour with no success.

I want to use the Schematron validator to validate a user registration 
form. Here's a snippet of the validating stylesheet:

<rule context="/password1">
   <assert test="string-length(.) &gt; 3">
     Password must be at least four characters long.
   </assert>
</rule>
<rule context="/password2">
   <assert test="string(.) = string(//password1)">
     Passwords do not match.
   </assert>
</rule>

This is just the latest in a series of permutations. The problem lies in 
the second rule. It either turns out to always validate, even if the 
passwords are different, or to never validate, even if the passwords are 
equal.

What's the correct way to write this rule?

	Thanks in Advance,

		Ugo


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


Re: [XMLForm,Validation] Testing for equality

Posted by Ugo Cei <u....@cbim.it>.
Ugo Cei wrote:
> <rule context="/password2">
>   <assert test="string(.) = string(//password1)">
>     Passwords do not match.
>   </assert>
> </rule>

Got it! Apparently it looks like I should do the following instead:

<rule context="/">
   <assert test="string(password1) = string(password2)">
     Passwords do not match.
   </assert>
</rule>


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