cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bruno Dumon <br...@outerthought.org>
Subject RE: XMLForm & JSF
Date Tue, 08 Apr 2003 18:46:11 GMT
On Tue, 2003-04-08 at 20:27, Hunsberger, Peter wrote:
> Bruno Dumon <bruno@outerthought.org> wrote: 
> 
> > > I've not had to do locale sensitive testing but I can see 
> > several ways 
> > > to do the basics: you can use the locale to select matchers out of 
> > > embedded structures or alternatively I suppose, as a worst 
> > case, you 
> > > could allways code up a choose block using the "lang()" 
> > function. For 
> > > numbers there is also a worst case of specifying the decimal-format 
> > > yourself in a choose block...
> > 
> > I think decimal-format only has an effect on format-number(), 
> > not on number(). So here in Belgium, where we use "," as 
> > decimal point, we would not be able to parse numbers 
> > correctly (could be solved using XPath extension functions though).
> 
> Snip, yes I think you're correct. I guess you could use translate to convert
> things to a canonical format and then check if the input matched the
> formatted version of the canonical.  Slightly ugly (we'll really ugly if
> you've got to swap "," and ".") but it would avoid extensions...

And actually, yes, we need to swap "," and "." :-)

(dot is the thousands separator over here -- it's the inverse of the US
conventions)

But if one needs to repeat this same approach (which seems like a hack
to me) for all fields to be validated, multiplied with all the locales
to be supported, then I much prefer to simply use Java's
NumberFormat.parse() method.

And we haven't talked about dates yet...

-- 
Bruno Dumon                             http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno@outerthought.org                          bruno@apache.org


Mime
View raw message