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

Conditional Setting of a locale

Subject: Conditional Setting of a locale
From: Mark Anderson <mark.anderson@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 15 May 2008 18:00:33 +0100
 Conditional Setting of a locale
Hi All

I'm stuck with decimal formatting in my XSL stylesheet (XSLT 1.0 only).

My users are based in UK (so locale is en-GB), but they need to output
documents with figures in Euro's, US$ and GBP. The latter two are no problem,
but I can't figure out a way to change the decimal format for documents being
sent to Europe.

I have an XML element called <currency> that tells me the target currency.
Conceptually, I want to do this:

<xsl:choose>
        <xsl:when test="currency = 'Euro'">
        <xsl:decimal-format name="standard" decimal-separator=","
grouping-separator="."/>
            <xsl:variable name="number" select="#.,00"/>
        </xsl:when>
        <xsl:otherwise>
            <xsl:decimal-format name="standard" decimal-separator="."
grouping-separator=","/>
            <xsl:variable name="number" select="#,.00"/>
        </xsl:otherwise>
</xsl:choose>

Unfortunately, it's not possible as xsl:decimal-format needs to be at the top
level and xsl:choose, etc. must be in the template body.

So, is there a way to set the decimal format based on the content of the XML
with all docs being generated in an single locale?

I'd like to extend this to date formatting too if possible.

TIA

Mark

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.