[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: XSL : Numbers to Words
> From: Renganat Krishnan [mailto:renganat_krishnan@xxxxxxxxx] > > I was wondering if anyone has acheived this > > Converting a number to Words in XSL. > > Xample > > <a> > <num>10000</num> > </a> > output from xsl on this xml should be > <a> > <numInWords>ten thousand</numInWords> > </a> > If you want to be able to translate any kind of number of any size, I think it would be pretty hard. But if the range and type of the numbers were constrained to some degree it should be feasible. Say you know that you will be dealing with only integers smaller than 100,000. You would use lookup tables to get the right words. I have done something like this to create (quasi!)natural language driving directions from a set of turn-by-turn data (e.g., "at the intersection with I-95 bear left onto Rt. 50S"). I have also done a bit of work getting graphs (like bar charts) to auto-scale, and this seems similar as well - you work out the right tests, and index into a lookup table using the test results. The lookup table can either be embedded into the stylesheet or it can be an external xml file. I'm sure it is feasible, as long as the range is restricted in some kind of sensible fashion. You will probably want to get familiar with recursive templates. Cheers, Tom P
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|