[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Re: [xsl] Convert dollars
Subject: Re: [xsl] Convert dollars From: Karl Stubsjoen <kstubs@xxxxxxxxx> Date: Sat, 16 Jan 2010 22:49:20 -0700 |
Thanks Ken, I just completely misplaced that one. Karl.. On Sat, Jan 16, 2010 at 9:39 PM, G. Ken Holman <gkholman@xxxxxxxxxxxxxxxxxxxx> wrote: > At 2010-01-16 21:26 -0700, Karl Stubsjoen wrote: >> >> Besides a recursive template which strips obvious dollar syntax from a >> string, is there a better way to achieve a number from items like: >> $ 330.01 >> $ 1,100.32 >> - 234 >> 1 >> $5 >> -16.23 >> Notice the negative, this should be preserved. >> I'm interested in a 1.0 solution. > > When you know the characters to remove, use this: > > translate(.,'$ ,','') > > When you don't know the characters to remove, use the double-translate > idiom: > > translate(.,translate(.,'-0123456789.',''),'') > > I hope this helps. > > . . . . . . . . . . . . Ken > > > -- > UBL and Code List training: Copenhagen, Denmark 2010-02-08/10 > XSLT/XQuery/XPath training after http://XMLPrague.cz 2010-03-15/19 > XSLT/XQuery/XPath training: San Carlos, California 2010-04-26/30 > Vote for your XML training: http://www.CraneSoftwrights.com/s/i/ > Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ > Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video > Video lesson: http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18 > Video overview: http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18 > G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx > Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/s/bc > Legal business disclaimers: http://www.CraneSoftwrights.com/legal
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Convert dollars, G. Ken Holman | Thread | [xsl] Match nodes searching for att, cvergara |
Re: [xsl] Convert dollars, G. Ken Holman | Date | [xsl] Match nodes searching for att, cvergara |
Month |
Keywords