From: <[EMAIL PROTECTED]> > > Hello, > > Let's say I have an instance data node called MOTHERS_STREET_ADDRESS. I want to > create a constraint that says these characters are illegal: ^ # *( ), but these > are ok . (period) @ &. The xf:caption of the xf:textbox is "Street"
<snip> > >If we make ai18n-enabled form then this approach can be a problem as we > >should have translations for all the possible cases and values. Haven't yet > >time to investigate the possibilities better, but I think that one can use > >dictionary keys instead of a real message, e.g.: > > ><rule context="/email"> > > <assert test="contains( string(.),'@')"> > > error.email.wrongformat > > </assert> > ></rule> > > > >and have a translation like this in dictionary: > ><message key="error.email.wrongformat">Wrong email format. Email should look > >like {0}.</message> > > > >then have this in the form: > ><i18n:translate> > > <i18n:text><xf:violation ref="/email"/></i18n:text> > > <i18n:param>[EMAIL PROTECTED]</i18n:param> > ></i18n:translate> > > > >The other problem here would be to know what are the needed params for a > >particular case. > </snip> > > Didn't get the part about "needed params". Haven't had time to study the i18n > stuff yet, but all this looks *very* cool. I mean, that on different violation types you'll have to provide different sets of additional params, e.g., if you have a date field with dependency on another field (say birthdate field) violations can be these: - Birthdate is required (no params needed) - Incorrect date format. Use {0} format ({0} = dd/mm/yyyy) - Birthdate should be less then {0} and greater then {1} ({0} = passport issue date, {1} = today's date) etc. Currently, I don't see any possibility to determine what are the needed params without changing i18n transformer somehow to get values from request attributes (or instance date) or have XSP form to generate needed params dynamically. I have a pending enhancement to i18n transformer that I haven't yet time to investigate and apply. Maybe it'll make such tasks simpler. Konstantin > > Cheers, > --Michael > > > > > "Konstantin > Piroumian" To: <[EMAIL PROTECTED]> > <kpiroumian@apach cc: > e.org> Subject: Re: [Announcement] XMLForm 0.8.2 released > > 05/16/02 04:50 AM > Please respond to > cocoon-dev > > > > > > > Hi! > > From: <[EMAIL PROTECTED]> > > > > I'd like to comment on this: > > > > > Do you plan to support Schematron <report> element? Would make it easier > to > > write rules like "/foo is invalid if it contains any of the following > > characters: #, &, *, %", or "/foo may contain only digits 0-9 and decimal > > point". > > > > Is there any way to implement Schematron <name> and <value-of> elements? > Since > > XMLForm validates against instance data rather than the entire form > description, > > I don't see how it can retrieve this sort of context. Still, it would be > nice > > to be able to write rules like this: > > <name ref="../xf:caption> cannot contain <value-of select > > ="/some/xpath/expression"> > > to produce a violation like this: > > "Street Name cannot contain a "$" > > If we make ai18n-enabled form then this approach can be a problem as we > should have translations for all the possible cases and values. Haven't yet > time to investigate the possibilities better, but I think that one can use > dictionary keys instead of a real message, e.g.: > > <rule context="/email"> > <assert test="contains( string(.),'@')"> > error.email.wrongformat > </assert> > </rule> > > and have a translation like this in dictionary: > <message key="error.email.wrongformat">Wrong email format. Email should look > like {0}.</message> > > then have this in the form: > <i18n:translate> > <i18n:text><xf:violation ref="/email"/></i18n:text> > <i18n:param>[EMAIL PROTECTED]</i18n:param> > </i18n:translate> > > The other problem here would be to know what are the needed params for a > particular case. > > Regards, > Konstantin > > > > > Cheers, > > --Michael > > > > > > > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, email: [EMAIL PROTECTED] > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, email: [EMAIL PROTECTED] > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, email: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]