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

RE: format number with changeable currency symbol

Subject: RE: format number with changeable currency symbol
From: "James Steven" <JSteven@xxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 21 Jun 2004 12:19:17 +0100
xsl currency
Can I use the example you provided with an xml element with a currency
symbol as its value?
-----Original Message-----
From: Brian Chrisman [mailto:brian.chrisman@xxxxxx]
Sent: 18 June 2004 20:59
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re:  format number with changeable currency symbol


Are you trying to format the string:
$-5,000.00 into -$5,000.00?

if so, would this do what you want?  Treating it as a string rather than
number?

<xsl:variable name="firsttwo" select="substring(Num, 1, 2)"/>
<xsl:choose>
<xsl:when test="contains($firsttwo, '$-')">
  <xsl:value-of select="concat('-$', substring-after(Num, $firsttwo))"/>
</xsl:when>
<xsl:otherwise>
  <xsl:value-of select="Num"/>
</xsl:otherwise>
</xsl:choose>

insert yer favorite currency symbol as a variable if necessary...?

James Steven wrote:

>If I have a negative number surely concat() will not be able to put the
>minus sign to the left of the currency symbol which is how format number
>displays it.
>
>I have tried using <xsl:if> as shown below but this isn't displaying
>anything.  Should this method work and if yes is there anything wrong with
>the code?
>
><xsl:variable name="Symbol" select="Anything/CurrencySymbol"/>
><xsl:if test="contains($Symbol, '$')">
><xsl:value-of select="format-number($sumorg, '$###,###,##0.00')"/>
></xsl:if>
>
>
>
>-----Original Message-----
>From: Michael Kay [mailto:mhk@xxxxxxxxx]
>Sent: 18 June 2004 12:28
>To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
>Subject: RE:  format number with changeable currency symbol
>
>
>
>
>>I have been able to put in a currency symbol with xslt 1.0
>>using format
>>number.  But that currency symbol is fixed.  Is there a way
>>to interchange
>>the currency symbol whilst keeping the minus sign to the left
>>of it.  What
>>do you mean by doing it "by hand"?
>>
>>
>
>I mean add the currency sign to the number using concat().
>
>Michael Kay
>
>
>
>
>>-----Original Message-----
>>From: Michael Kay [mailto:mhk@xxxxxxxxx]
>>Sent: 18 June 2004 10:30
>>To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
>>Subject: RE:  format number with changeable currency symbol
>>
>>
>>XSLT 1.0 explicitly doesn't allow the currency symbol, though some
>>implementations may let you get away with it (XSLT 1.0 specified
>>format-number() in terms of the JDK 1.1 specifications, but
>>implementations
>>using a newer release of Java may "accidentally" expose facilities
>>introduced in later JDK versions.)
>>
>>I would avoid trying to do this with format-number(), and do
>>it "by hand".
>>
>>Michael Kay
>>
>>
>>
>>>-----Original Message-----
>>>From: James Steven [mailto:JSteven@xxxxxxxxxxxxxxxxxxxxx]
>>>Sent: 18 June 2004 09:33
>>>To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
>>>Subject:  format number with changeable currency symbol
>>>
>>>Hello
>>>I would like to format a number so that it can be shown with
>>>any type of
>>>currency symbol in front of it.  Currently I am using eg.
>>><xsl:value-of
>>>select="format-number(12345, '?###,###,##0.00')"/> but this
>>>only formats the
>>>number with a ?.
>>>
>>>Also I have tried putting a currency symbol element in the
>>>xml and including
>>>that in the xsl to be inserted before the number.  The
>>>trouble with this
>>>method is that if the figure is a negative number the minus
>>>sign is inserted
>>>after the currency symbol which is no good.  Is there a way that the
>>>format-number function can be used with a currency symbol
>>>element from the
>>>xml so that the currency symbol can be changed in the xml?
>>>Or is there any
>>>other way to solve this?
>>>
>>>Thanks for your help.
>>>James
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>--+------------------------------------------------------------------
>>
>>
>>>XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>>>To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
>>>or e-mail: <mailto:xsl-list-unsubscribe@xxxxxxxxxxxxxxxxxxxxxx>
>>>--+--
>>>
>>>
>>>
>>>
>>--+------------------------------------------------------------------
>>XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>>To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
>>or e-mail: <mailto:xsl-list-unsubscribe@xxxxxxxxxxxxxxxxxxxxxx>
>>--+--
>>
>>
>>
>>This message has been scanned for unacceptable content by 'VITANIUM'
>>the industry leading email virus and content management service from
>>Vitanium Systems. Contact details are available at www.vitanium.com.
>>
>>
>>
>>
>>
>>--+------------------------------------------------------------------
>>XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>>To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
>>or e-mail: <mailto:xsl-list-unsubscribe@xxxxxxxxxxxxxxxxxxxxxx>
>>--+--
>>
>>
>>
>>
>
>
>--+------------------------------------------------------------------
>XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
>or e-mail: <mailto:xsl-list-unsubscribe@xxxxxxxxxxxxxxxxxxxxxx>
>--+--
>
>
>
>This message has been scanned for unacceptable content by 'VITANIUM'
>the industry leading email virus and content management service from
>Vitanium Systems. Contact details are available at www.vitanium.com.
>
>
>
>
>
>--+------------------------------------------------------------------
>XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
>or e-mail: <mailto:xsl-list-unsubscribe@xxxxxxxxxxxxxxxxxxxxxx>
>--+--
>
>


--+------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe@xxxxxxxxxxxxxxxxxxxxxx>
--+--



This message has been scanned for unacceptable content by 'VITANIUM'
the industry leading email virus and content management service from
Vitanium Systems. Contact details are available at www.vitanium.com.





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.