Important Notice from AspDotNetStorefront
It is with dismay that we report that we have been forced, through the action of hackers, to shut off write-access to this forum. We are keen to leave the wealth of material available to you for research. We have opened a new forum from which our community of users can seek help, support and advice from us and from each other. To post a new question to our community, please visit: http://forums.vortx.com
Results 1 to 3 of 3

Thread: showing 2 currencies in XMLPackage

  1. #1
    Jordan is offline Member
    Join Date
    Feb 2006
    Posts
    42

    Default showing 2 currencies in XMLPackage

    I'm trying to display both Canadian and US pricing according to my locale currency tables. The site's base currency is configured as CAD (which is default for the en-CA locale) and I'd also like display USD (defualt for the en-US locale).

    I figured this could be done by the FormatCurrency function, passing in a locale. I've tried this, but the FormatCurrency always seems to use the site's global locale rather then what I'm passing in...



    <xslaram name="USLocale">en-US</xslaram>
    <xslaram name="CALocale">en-CA</xslaram>


    <li class="ca_price">
    <xsl:value-of select="aspdnsf:FormatCurrency(Price, CALocale)" disable-output-escaping="yes" />
    </li>

    <li class="us_price">
    <xsl:value-of select="aspdnsf:FormatCurrency(Price, USLocale)" disable-output-escaping="yes" />
    </li>



    I've also tried the following with no success:

    <li class="ca_price">
    <xsl:value-of select="aspdnsf:FormatCurrency(Price, en-CA)" disable-output-escaping="yes" />
    </li>

    <li class="us_price">
    <xsl:value-of select="aspdnsf:FormatCurrency(Price, en-US)" disable-output-escaping="yes" />
    </li>



    Thoughts?
    ________
    Legally_Blond
    Last edited by Jordan; 08-13-2011 at 08:22 AM.

  2. #2
    webopius is offline Senior Member
    Join Date
    Nov 2008
    Location
    London, UK
    Posts
    440

    Default

    Hi

    I've not had a chance to test this but I suspect no locale info is being passed to the FormatCurrent function because...

    In the first version, change CALocale and USLocale to $CALocale and $USLocale, like this:

    <xsl:value-of select="aspdnsf:FormatCurrency(Price, $CALocale)" disable-output-escaping="yes" />

    In the second version, put single quotes around the locale (otherwise ASPDNSF will think it's looking for an XML node), like this:

    <xsl:value-of select="aspdnsf:FormatCurrency(Price, 'en-CA')" disable-output-escaping="yes" />

    Let me know if this works - if not, get back in touch and I'll try logging into one of our servers and making a similar change to see what happens - I'm just being lazy now!

    Adam

  3. #3
    Jordan is offline Member
    Join Date
    Feb 2006
    Posts
    42

    Default

    Nice, that works, only it expects the currency name, not the locale.


    Appreciate the help!
    ________
    HelenH
    Last edited by Jordan; 08-13-2011 at 08:22 AM.