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]