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
[EMAIL PROTECTED]
www.virbus.de


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to