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(.) > 5">Name should be at least 6 characters.</assert> <assert test="string-length(.) < 60">Password should be less than 60 characters.</assert> </rule> <rule context="/password2"> <assert test="string-length(.) > 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.] > -----Original Message----- > From: Rob Johnston [mailto:[EMAIL PROTECTED] > Sent: Wednesday, March 26, 2003 10:35 AM > To: [EMAIL PROTECTED] > Subject: Re: XMLForm Schematron question > > > On Wed, 26 Mar 2003, Joerg Heinicke wrote: > > > Hello Rob, > > > > you simply must add a predicate to the context: > > > > <rule context="/data/number[/data/selected = 'number']"> > > <assert test="number(.)=."> > > You must specify a valid number. > > </assert> > > </rule> > > Sweet. I hadn't even thought about putting a predicate there. That > worked perfectly. I appreciate it! > > thanks, > rob > > > Furthermore I think you should change the test pattern. If > someone writes > > 5.0, it can return false. I have in mind 5.0 and 5, if the > transformer > > tests on strings and not on numbers. (I had the same > problem a few days ago > > with XSLT. Is the behaviour simply processor dependent or specified > > anywhere?) If you change the test to "number() = number()" > you are on the > > safe side, because "NaN = NaN" returns always false. > > > > Regards, > > > > Joerg > > > > Rob Johnston wrote: > > >Hello -- I have a quick Schematron/XMLForm question. > > > > > >Let's say I have the following XPath: > > > > > >/data/selected which can be either "text" or "number" > > >/data/number a valid number > > > > > >I want to write a validation pattern that will assert iff > /data/selected > > >is 'number' and /data/number must be a number. > > > > > >For instance: > > > > > ><rule context="/data/number"> > > > <assert test="number(.)=."> > > > You must specify a valid number. > > > </assert> > > ></rule> > > > > > >works fine, but I want the above to happen ONLY if > /data/selected is the > > >value "number". So if /data/selected is the value "text", it will > > >completely ignore the check to see if the /data/number field is a > > >numeric value. > > > > > >Any help would be appreciated. > > > > > >thanks, > > >rob > > > > -- > > > > System Development > > VIRBUS AG > > Fon +49(0)341-979-7419 > > Fax +49(0)341-979-7409 > > [EMAIL PROTECTED] > > www.virbus.de > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]