[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Numbers to Words

Subject: Re: Numbers to Words
From: Nadia.Swaby@xxxxxx
Date: Mon, 13 Jun 2005 12:53:18 -0400
numbers written in words
Hi Dave,

Check out Section 12.3 (Number to String Conversion Attributes) of the XSLT
2.0 working draft http://www.w3.org/TR/xslt20/#convert

The main attribute is format. The default value for the format attribute is
1. The format attribute is split into a sequence of tokens where each token
is a maximal sequence of alphanumeric characters or a maximal sequence of
non-alphanumeric characters. Alphanumeric means any character that has a
Unicode category of Nd, Nl, No, Lu, Ll, Lt, Lm or Lo.

      A format token w generates numbers written as lower-case words, for
      example in English, one two three four ...
      A format token W generates numbers written as upper-case words, for
      example in English, ONE TWO THREE FOUR ...
      A format token Ww generates numbers written as title-case words, for
      example in English, One Two Three Four ...

So, no it isn't April 1st and yes, you did miss something :)

Nadia


                                                                                                                                     
                      Dave Pawson                                                                                                    
                      <davep@xxxxxxxxxx        To:       Xsl List <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>                                  
                      .uk>                     cc:                                                                                   
                                               Subject:  Re:  Numbers to Words                                                  
                      2005-06-13 11:41                                                                                               
                      Please respond to                                                                                              
                      xsl-list                                                                                                       
                                                                                                                                     
                                                                                                                                     




On Mon, 2005-06-13 at 12:13 +0100, David Carlisle wrote:
> This will be particularly easy in xslt2:
>
>  <xsl:stylesheet
>  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>                                  version="2.0">
>
>   <xsl:output method="text" />
>
>
> <xsl:template match="/">
> <xsl:number value="65314142" format="w"/>
> </xsl:template>
>
>  </xsl:stylesheet>
>
>
>
> $ saxon8 words.xsl words.xsl
> sixty five million three hundred and fourteen thousand one hundred and
forty two

Is it April 1, or did I miss something?

David, could you | would you, expand please?




--
Regards,

Dave Pawson
XSLT + Docbook FAQ
http://www.dpawson.co.uk

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.