RE: How to not check a textbox if empy

"Edvard Robertsson" <[email protected]> Mon, 12 May 2003 14:25:48 +0200
Newsgroups gmane.text.xml.schematron
Message-ID <[email protected]>
Hi,

>Thanks, it works.
>
>Is it also possible, instead of do not check the format if the textbox is 
>empty, to check the format
>only if a checkbox is set to true?

Sure. The assertion test would depend on how the checkbox is represented in 
the XML but if your XML looks something like:

<textbox checkbox="true/false">...value...</textbox>

you can do this with:

<!-- CHECK FOR VALID FORMAT -->
<sch:assert test="@checkbox = 'false' or (...... check format......)">
     <sch:name/> does not contain a valid format.
</sch:assert>

This will only check the value of the textbox if the attribute checkbox has 
a value != 'false'

Cheers,
/Eddie




>
>Regards
>Sylvain
>
>
>-----Message d'origine-----
>De: Edvard Robertsson [mailto:[email protected]]
>Date: samedi, 10. mai 2003 12:12
>À: Thévoz Sylvain, IT-DTS-ENG-SDM-DAR;
>[email protected]
>Objet: Re: [Schematron-love-in] How to not check a textbox if empy
>
>
>Hi Sylvain,
>
> >I need to check the format of a string in a textbox.
> >But I want to check ONLY if there is something in the textbox.
> >I need to have the possibility to not enter a value in this textbox.
> >
> >Here is the pseudo-code to check the format:
> >
> ><!-- CHECK FOR VALID FORMAT -->
> ><sch:assert test="
> >...... check format......
> >    ">
> >    <sch:name/> does not contain a valid format.
> ></sch:assert>
> >
> >How could I do that?
>
>I think you can just add to the assertion that either the text content is
>empty OR it conforms to the specfic format:
>
><!-- CHECK FOR VALID FORMAT -->
><sch:assert test="string-length(.)=0 or (...... check format......)">
>     <sch:name/> does not contain a valid format.
></sch:assert>
>
>Cheers,
>/Eddie
>
> >
> >Thanks
> >Sylvain
> >
> >
> >-------------------------------------------------------
> >Enterprise Linux Forum Conference & Expo, June 4-6, 2003, Santa Clara
> >The only event dedicated to issues related to Linux enterprise solutions
> >www.enterpriselinuxforum.com
> >
> >_______________________________________________
> >Schematron-love-in mailing list
> >[email protected]
> >https://lists.sourceforge.net/lists/listinfo/schematron-love-in
>
>_________________________________________________________________
>Add photos to your e-mail with MSN 8. Get 2 months FREE*.
>http://join.msn.com/?page=features/featuredemail
>

_________________________________________________________________
The new MSN 8: advanced junk mail protection and 2 months FREE* 
http://join.msn.com/?page=features/junkmail



-------------------------------------------------------
Enterprise Linux Forum Conference & Expo, June 4-6, 2003, Santa Clara
The only event dedicated to issues related to Linux enterprise solutions
www.enterpriselinuxforum.com