Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old August 26th, 2008, 12:59 AM
Authorized User
Points: 166, Level: 3
Points: 166, Level: 3 Points: 166, Level: 3 Points: 166, Level: 3
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Feb 2008
Location: , , .
Posts: 37
Thanks: 0
Thanked 0 Times in 0 Posts
Default Can XSLT convert amount to words

Hi,

I am using XSLT 1.0. In the report i have a requirement to display the amount in to words. Can anyone tell me whether it is possible to do this in XSLT.



Reply With Quote
  #2 (permalink)  
Old August 26th, 2008, 01:50 AM
samjudson's Avatar
Friend of Wrox
Points: 8,687, Level: 40
Points: 8,687, Level: 40 Points: 8,687, Level: 40 Points: 8,687, Level: 40
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2007
Location: Newcastle, , United Kingdom.
Posts: 2,133
Thanks: 1
Thanked 189 Times in 188 Posts
Default

I've no doubt it is possible, as most things are.

There isn't any built in feature to allow you to do this, but I'm sure a template could be written to convert a number into words. This template probably wouldn't be simple however.



/- Sam Judson : Wrox Technical Editor -/
Reply With Quote
  #3 (permalink)  
Old August 26th, 2008, 03:09 AM
mhkay's Avatar
Wrox Author
Points: 18,392, Level: 59
Points: 18,392, Level: 59 Points: 18,392, Level: 59 Points: 18,392, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,947
Thanks: 0
Thanked 288 Times in 283 Posts
Default

There is no standard facility in XSLT 1.0 to do this. It is available as an extension in at least one XSLT 1.0 processor (Saxon); apart from that, you will have to call out to an external library.

XSLT 2.0 has this capability as standard:

<xsl:number value="1234" format="w" lang="en"/>

outputs something like "one thousand two hundred and thirty four"



Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer's Reference
Reply With Quote
  #4 (permalink)  
Old January 10th, 2018, 02:20 AM
Registered User
Points: 3, Level: 1
Points: 3, Level: 1 Points: 3, Level: 1 Points: 3, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2018
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Michael, i have used
<xsl:number value="1234" format="w" lang="en"/> and is working for me.

I need to convert the test in spanish language, so tried the below


<xsl:number value="1234" format="w" lang="es"/>, but still i am getting results in english language.

Can you help on this?
Reply With Quote
  #5 (permalink)  
Old January 10th, 2018, 03:09 AM
mhkay's Avatar
Wrox Author
Points: 18,392, Level: 59
Points: 18,392, Level: 59 Points: 18,392, Level: 59 Points: 18,392, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,947
Thanks: 0
Thanked 288 Times in 283 Posts
Default

The question of which languages are supported depends on the XSLT processor you are using.

If you're using Saxon, then it depends on which version & edition: please raise Saxon-specific questions on the Saxon help forums at saxonica.plan.io.

If you're using a different XSLT 2.0 processor, e.g. IBM or Altova, please contact the respective vendor.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert Currency To Words Kenny Alligood Access 3 October 12th, 2017 06:00 AM
Subject: Convert XML using XSLT manoj1984 XSLT 6 May 30th, 2008 04:27 PM
Convert Numbers to Words hasankelepir Classic ASP Basics 5 October 1st, 2007 07:15 AM
XSLT - Convert the date in different format haixia XSLT 1 August 25th, 2006 11:51 AM
convert number into words on acces form superparim Wrox Book Feedback 0 September 19th, 2005 01:55 PM



All times are GMT -4. The time now is 11:55 AM.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.