From: Loren C. <lor...@gm...> - 2010-07-15 17:39:09
|
I am in the process of adding the formatting of a number to a formatted string. There are three general purpose functions that format the number to a general number, currency or percentage according to the optionally specified locale. The fourth function takes in a format string according to the format specification for the java.text.DecimalFormat Java class. Please supply me with your comments. Dan will be developing XQuery unit tests to validate the functions. You will find the function docs below. Thank you, Loren number-to-currency-string util:number-to-currency-string($number as xs:double, $locale as xs:string?) xs:string? Returns a currency number formatted for the specified locale if specified (default otherwise) as an xs:string value. $number The number $locale two-letter ISO-639 code representing the locale Returns the formatted string number-to-formatted-string util:number-to-formatted-string($number as xs:double, $format as xs:string) xs:string? Returns the number formatted as an xs:string value. $number The number $format The format pattern string. Please see the JavaDoc for java.text.DecimalFormat to get the specifics of this format string. Returns the formatted string number-to-percent-string util:number-to-percent-string($number as xs:double, $locale as xs:string?) xs:string? Returns a percentage number formatted for the specified locale if specified (default otherwise) as an xs:string value. $number The number $locale two-letter ISO-639 code representing the locale Returns the formatted string number-to-string util:number-to-string($number as xs:double, $locale as xs:string?) xs:string? Returns a general-purpose number formatted for the specified locale if specified (default otherwise) as an xs:string value. $number The number $locale two-letter ISO-639 code representing the locale Returns the formatted string |
From: Dmitriy S. <sha...@gm...> - 2010-07-15 18:02:02
Attachments:
smime.p7s
|
Can it be xsl's function? http://www.w3schools.com/XSL/func_formatnumber.asp (the module @ xsl extension) Can it be one function? On Thu, 2010-07-15 at 12:39 -0500, Loren Cahlander wrote: > I am in the process of adding the formatting of a number to a > formatted string. There are three general purpose functions that > format the number to a general number, currency or percentage > according to the optionally specified locale. The fourth function > takes in a format string according to the format specification for the > java.text.DecimalFormat Java class. > > > Please supply me with your comments. Dan will be developing XQuery > unit tests to validate the functions. You will find the function docs > below. -- Cheers, Dmitriy Shabanov |
From: Loren C. <lor...@gm...> - 2010-07-15 18:59:35
|
I can implement format-number http://www.w3.org/TR/xslt#function-format-number Do we want this in util or in fn (http://www.w3.org/2005/xpath-functions)? All I need to do is remove the three functions (number-to-string, number-to-currency-string, and number-to-percent-string) and change number-to-formatted-string to format-number and add the third optional parameter. I just want to make sure that I place it in the correct function module. Loren On Jul 15, 2010, at 01:02 PM, Dmitriy Shabanov wrote: > Can it be xsl's function? > http://www.w3schools.com/XSL/func_formatnumber.asp > > (the module @ xsl extension) > > Can it be one function? > > On Thu, 2010-07-15 at 12:39 -0500, Loren Cahlander wrote: >> I am in the process of adding the formatting of a number to a >> formatted string. There are three general purpose functions that >> format the number to a general number, currency or percentage >> according to the optionally specified locale. The fourth function >> takes in a format string according to the format specification for the >> java.text.DecimalFormat Java class. >> >> >> Please supply me with your comments. Dan will be developing XQuery >> unit tests to validate the functions. You will find the function docs >> below. > > -- > Cheers, > > Dmitriy Shabanov |
From: Dan M. <dan...@gm...> - 2010-07-15 19:13:22
|
My apologies, I was aware of the XQuery 1.1 specification for *format-number()* but I did not communicate this format clearly to Loren. Here is the proposed format in the 1.1 XQuery Working Draft standard: http://www.w3.org/TR/xquery-11/#id-decimal-format-decl I believe we should be working to try to make it consistent with this specification (i.e. also XPath 2.0) - Dan On Thu, Jul 15, 2010 at 12:39 PM, Loren Cahlander <lor...@gm... > wrote: > I am in the process of adding the formatting of a number to a formatted > string. There are three general purpose functions that format the number to > a general number, currency or percentage according to the optionally > specified locale. The fourth function takes in a format string according to > the format specification for the java.text.DecimalFormat Java class. > > Please supply me with your comments. Dan will be developing XQuery unit > tests to validate the functions. You will find the function docs below. > > Thank you, > > Loren > > > > number-to-currency-string<http://localhost:8080/exist/functions/util/number-to-currency-string> > ------------------------------ > util:number-to-currency-string($number as xs:double, $locale as xs:string?) > xs:string? > Returns a currency number formatted for the specified locale if specified > (default otherwise) as an xs:string value. > $numberThe number$localetwo-letter ISO-639 code representing the locale > ------------------------------ > Returns the formatted string > number-to-formatted-string<http://localhost:8080/exist/functions/util/number-to-formatted-string> > ------------------------------ > util:number-to-formatted-string($number as xs:double, $format as xs:string) > xs:string? > Returns the number formatted as an xs:string value. > $numberThe number$formatThe format pattern string. Please see the JavaDoc > for java.text.DecimalFormat to get the specifics of this format string. > ------------------------------ > Returns the formatted string > number-to-percent-string<http://localhost:8080/exist/functions/util/number-to-percent-string> > ------------------------------ > util:number-to-percent-string($number as xs:double, $locale as xs:string?) > xs:string? > Returns a percentage number formatted for the specified locale if specified > (default otherwise) as an xs:string value. > $numberThe number$localetwo-letter ISO-639 code representing the locale > ------------------------------ > Returns the formatted string > number-to-string<http://localhost:8080/exist/functions/util/number-to-string> > ------------------------------ > util:number-to-string($number as xs:double, $locale as xs:string?) > xs:string? > Returns a general-purpose number formatted for the specified locale if > specified (default otherwise) as an xs:string value. > $numberThe number$localetwo-letter ISO-639 code representing the locale > ------------------------------ > Returns the formatted string > > > > -- Dan McCreary Semantic Solutions Architect office: (952) 931-9198 cell: (612) 986-1552 |
From: Thomas W. <tho...@gm...> - 2010-07-16 07:40:54
|
I am glad the localization is in the focus now. Dan, I think the the proposal is good but it does not cover all issues related to the localisation. I think the best way to organise the code is to create a module dedicated for all localisation functions called l18n. The functions I can see there for now could be: localized-date( $date as xs:datetime, $locale as xs:string) localized-currency( $number as xs:double, $locale as xs:string) localized-percent( $number as xs:double, $locale as xs:string) localized-number( $number as xs:double, $locale as xs:string) and many other localized function to come... I do believe it is much better to have a specialised function for every data type instead of a generic function with a parameter. It is much more clear when one reads the code with dedicted functions. Loren, I agree with you number-to-formatted-string should go to util module because of it generic nature. I hope this will help. Thomas ------ Thomas White Mobile:+44 7711 922 966 Skype: thomaswhite gTalk: thomas.0007 Linked-In:http://www.linkedin.com/in/thomaswhite0007 facebook: http://www.facebook.com/thomas.0007 On 15 July 2010 20:13, Dan McCreary <dan...@gm...> wrote: > My apologies, > > I was aware of the XQuery 1.1 specification for *format-number()* but I > did not communicate this format clearly to Loren. > > Here is the proposed format in the 1.1 XQuery Working Draft standard: > > http://www.w3.org/TR/xquery-11/#id-decimal-format-decl > > I believe we should be working to try to make it consistent with this > specification (i.e. also XPath 2.0) > > - Dan > > > On Thu, Jul 15, 2010 at 12:39 PM, Loren Cahlander < > lor...@gm...> wrote: > >> I am in the process of adding the formatting of a number to a formatted >> string. There are three general purpose functions that format the number to >> a general number, currency or percentage according to the optionally >> specified locale. The fourth function takes in a format string according to >> the format specification for the java.text.DecimalFormat Java class. >> >> Please supply me with your comments. Dan will be developing XQuery unit >> tests to validate the functions. You will find the function docs below. >> >> Thank you, >> >> Loren >> >> >> >> number-to-currency-string<http://localhost:8080/exist/functions/util/number-to-currency-string> >> ------------------------------ >> util:number-to-currency-string($number as xs:double, $locale as >> xs:string?) xs:string? >> Returns a currency number formatted for the specified locale if >> specified (default otherwise) as an xs:string value. >> $number The number $locale two-letter ISO-639 code representing the >> locale >> ------------------------------ >> Returns the formatted string >> number-to-formatted-string<http://localhost:8080/exist/functions/util/number-to-formatted-string> >> ------------------------------ >> util:number-to-formatted-string($number as xs:double, $format as >> xs:string) xs:string? >> Returns the number formatted as an xs:string value. >> $number The number $format The format pattern string. Please see the >> JavaDoc for java.text.DecimalFormat to get the specifics of this format >> string. >> ------------------------------ >> Returns the formatted string >> number-to-percent-string<http://localhost:8080/exist/functions/util/number-to-percent-string> >> ------------------------------ >> util:number-to-percent-string($number as xs:double, $locale as xs:string?) >> xs:string? >> Returns a percentage number formatted for the specified locale if >> specified (default otherwise) as an xs:string value. >> $number The number $locale two-letter ISO-639 code representing the >> locale >> ------------------------------ >> Returns the formatted string >> number-to-string<http://localhost:8080/exist/functions/util/number-to-string> >> ------------------------------ >> util:number-to-string($number as xs:double, $locale as xs:string?) >> xs:string? >> Returns a general-purpose number formatted for the specified locale if >> specified (default otherwise) as an xs:string value. >> $number The number $locale two-letter ISO-639 code representing the >> locale >> ------------------------------ >> Returns the formatted string >> >> >> >> > > > -- > Dan McCreary > Semantic Solutions Architect > office: (952) 931-9198 > cell: (612) 986-1552 > > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by Sprint > What will you do first with EVO, the first 4G phone? > Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first > _______________________________________________ > Exist-development mailing list > Exi...@li... > https://lists.sourceforge.net/lists/listinfo/exist-development > > |
From: Dmitriy S. <sha...@gm...> - 2010-07-15 19:21:09
Attachments:
smime.p7s
|
XSL have status recommendation & it have this function. eXist have this module http://exist.svn.sourceforge.net/viewvc/exist/trunk/eXist/extensions/xslt/src/org/exist/xslt/functions/ (NOTE: the module namespace must be changed to http://www.w3.org/1999/XSL/Transform) -- Cheers, Dmitriy Shabanov On Thu, 2010-07-15 at 14:13 -0500, Dan McCreary wrote: > My apologies, > > I was aware of the XQuery 1.1 specification for format-number() but I > did not communicate this format clearly to Loren. > > Here is the proposed format in the 1.1 XQuery Working Draft standard: > > http://www.w3.org/TR/xquery-11/#id-decimal-format-decl > > I believe we should be working to try to make it consistent with this > specification (i.e. also XPath 2.0) > > - Dan > > On Thu, Jul 15, 2010 at 12:39 PM, Loren Cahlander > <lor...@gm...> wrote: > I am in the process of adding the formatting of a number to a > formatted string. There are three general purpose functions > that format the number to a general number, currency or > percentage according to the optionally specified locale. The > fourth function takes in a format string according to the > format specification for the java.text.DecimalFormat Java > class. > > > Please supply me with your comments. Dan will be developing > XQuery unit tests to validate the functions. You will find > the function docs below. > > > Thank you, > > > Loren > > > > > > > number-to-currency-string > > ______________________________________________________________ > util:number-to-currency-string($number as xs:double, $locale > as xs:string?) xs:string? > Returns a currency number formatted for the specified locale > if specified (default otherwise) as an xs:string value. > > > $number > The number > $locale > two-letter ISO-639 code > representing the locale > > ______________________________________________________________ > Returns the formatted string > number-to-formatted-string > > ______________________________________________________________ > util:number-to-formatted-string($number as xs:double, $format > as xs:string) xs:string? > Returns the number formatted as an xs:string value. > > > $number > The number > $format > The format pattern string. > Please see the JavaDoc for > java.text.DecimalFormat to get > the specifics of this format > string. > > ______________________________________________________________ > Returns the formatted string > number-to-percent-string > > ______________________________________________________________ > util:number-to-percent-string($number as xs:double, $locale as > xs:string?) xs:string? > Returns a percentage number formatted for the specified locale > if specified (default otherwise) as an xs:string value. > > > $number > The number > $locale > two-letter ISO-639 code > representing the locale > > ______________________________________________________________ > Returns the formatted string > number-to-string > > ______________________________________________________________ > util:number-to-string($number as xs:double, $locale as > xs:string?) xs:string? > Returns a general-purpose number formatted for the specified > locale if specified (default otherwise) as an xs:string value. > > > $number > The number > $locale > two-letter ISO-639 code > representing the locale > > ______________________________________________________________ > Returns the formatted string > > > > > > > > > > -- > Dan McCreary > Semantic Solutions Architect > office: (952) 931-9198 > cell: (612) 986-1552 > ------------------------------------------------------------------------------ > This SF.net email is sponsored by Sprint > What will you do first with EVO, the first 4G phone? > Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first > _______________________________________________ Exist-development mailing list Exi...@li... https://lists.sourceforge.net/lists/listinfo/exist-development |
From: Loren C. <lor...@gm...> - 2010-07-15 19:28:21
|
The conf.xml file just needs <module class="org.exist.xslt.functions.XSLTModule" uri="http://exist-db.org/xquery/xslt"/> added to it. On Jul 15, 2010, at 02:21 PM, Dmitriy Shabanov wrote: > XSL have status recommendation & it have this function. > > eXist have this module > http://exist.svn.sourceforge.net/viewvc/exist/trunk/eXist/extensions/xslt/src/org/exist/xslt/functions/ > > (NOTE: the module namespace must be changed to > http://www.w3.org/1999/XSL/Transform) > > -- > Cheers, > > Dmitriy Shabanov > > On Thu, 2010-07-15 at 14:13 -0500, Dan McCreary wrote: >> My apologies, >> >> I was aware of the XQuery 1.1 specification for format-number() but I >> did not communicate this format clearly to Loren. >> >> Here is the proposed format in the 1.1 XQuery Working Draft standard: >> >> http://www.w3.org/TR/xquery-11/#id-decimal-format-decl >> >> I believe we should be working to try to make it consistent with this >> specification (i.e. also XPath 2.0) >> >> - Dan >> >> On Thu, Jul 15, 2010 at 12:39 PM, Loren Cahlander >> <lor...@gm...> wrote: >> I am in the process of adding the formatting of a number to a >> formatted string. There are three general purpose functions >> that format the number to a general number, currency or >> percentage according to the optionally specified locale. The >> fourth function takes in a format string according to the >> format specification for the java.text.DecimalFormat Java >> class. >> >> >> Please supply me with your comments. Dan will be developing >> XQuery unit tests to validate the functions. You will find >> the function docs below. >> >> >> Thank you, >> >> >> Loren >> >> >> >> >> >> >> number-to-currency-string >> >> ______________________________________________________________ >> util:number-to-currency-string($number as xs:double, $locale >> as xs:string?) xs:string? >> Returns a currency number formatted for the specified locale >> if specified (default otherwise) as an xs:string value. >> >> >> $number >> The number >> $locale >> two-letter ISO-639 code >> representing the locale >> >> ______________________________________________________________ >> Returns the formatted string >> number-to-formatted-string >> >> ______________________________________________________________ >> util:number-to-formatted-string($number as xs:double, $format >> as xs:string) xs:string? >> Returns the number formatted as an xs:string value. >> >> >> $number >> The number >> $format >> The format pattern string. >> Please see the JavaDoc for >> java.text.DecimalFormat to get >> the specifics of this format >> string. >> >> ______________________________________________________________ >> Returns the formatted string >> number-to-percent-string >> >> ______________________________________________________________ >> util:number-to-percent-string($number as xs:double, $locale as >> xs:string?) xs:string? >> Returns a percentage number formatted for the specified locale >> if specified (default otherwise) as an xs:string value. >> >> >> $number >> The number >> $locale >> two-letter ISO-639 code >> representing the locale >> >> ______________________________________________________________ >> Returns the formatted string >> number-to-string >> >> ______________________________________________________________ >> util:number-to-string($number as xs:double, $locale as >> xs:string?) xs:string? >> Returns a general-purpose number formatted for the specified >> locale if specified (default otherwise) as an xs:string value. >> >> >> $number >> The number >> $locale >> two-letter ISO-639 code >> representing the locale >> >> ______________________________________________________________ >> Returns the formatted string >> >> >> >> >> >> >> >> >> >> -- >> Dan McCreary >> Semantic Solutions Architect >> office: (952) 931-9198 >> cell: (612) 986-1552 >> ------------------------------------------------------------------------------ >> This SF.net email is sponsored by Sprint >> What will you do first with EVO, the first 4G phone? >> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first >> _______________________________________________ Exist-development mailing list Exi...@li... https://lists.sourceforge.net/lists/listinfo/exist-development > |